Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

42337 Illegal instruction: 4

Andy5
Beginner
982 Views

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
TimP
Honored Contributor III
982 Views

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
Andy5
Beginner
982 Views

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
Steven_L_Intel1
Employee
982 Views

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.

0 Kudos
Andy5
Beginner
982 Views

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
Steven_L_Intel1
Employee
982 Views

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.

0 Kudos
TimP
Honored Contributor III
982 Views
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
Reply