Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
57 Views

42337 Illegal instruction: 4

Hi,

The Intel Fortran compiler on Mac, is giving me the error message:

 Illegal instruction: 4

What does this mean? And what can I do about it?

I think it is due to a compile option I am using with the Intel Fortran compiler, however I have no idea which flag is causing this.

Thanks,

Andy

 

 

0 Kudos
6 Replies
Highlighted
Black Belt
57 Views

Probably not good to set

Probably not good to set extra compiler options you don't understand.  Options -m and -x may be used to generate code for a newer CPU.  For example, -mavx2 would require a haswell CPU to run.  If you really mean that you got instruction fault while compiling, this would not explain it.

0 Kudos
Highlighted
Beginner
57 Views

Thank you, however I

Thank you, however I understand the compiler options I have. The question I am asking here is what the error message below means:

 Illegal instruction: 4

I would grateful if someone else who knows more on this message (perhaps someone from Intel) could provide more details on this.

Andy

0 Kudos
Highlighted
57 Views

It means that the program

It means that the program executed an instruction that the processor does not understand. As Tim suggests, if you have used -m to specify an instruction set not supported by your processor you'll get this error when one of those instructions is encountered.

Are you seeing this when running your program or when doing the compile? Your initial message suggested it was the compiler that got the error, and if that's the case you probably have a problem with the Mac itself.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
57 Views

Thank you Steve for that

Thank you Steve for that extra information.

I am seeing the error when the application starts up. It compiles okay and makes the executables. I have tried putting it through gdb however the output I get back when it crashes is not terribly useful. There are no '-m' flags being used.

Have you any suggestions on how to debug this?

Many thanks,

Andy

0 Kudos
57 Views

gdb should identify the

gdb should identify the location of the instruction that fails. You can generate a link map and see where in the program that is (though if you build with debug info, gdb should be able to tell you when it happens.) Does any part of the program execute before you get the error?  If you're seeing this without using -m, that suggests a jump or call to an incorrect location or stack corruption. Seeing what happens just before the error would be useful. I would typically set a breakpoint just before the error and use nexti to single step through the instructions to see what it was doing.

Most likely you will see either a call that goes into "hyperspace" (not a valid instruction location), or on a return that it returns incorrectly.

Retired 12/31/2016
0 Kudos
Highlighted
Black Belt
57 Views

If you have an architecture

If you have an architecture set in fort.cfg or elsewhere it should appear in header comments of asm output made with -S
0 Kudos