Illegal instruction

Illegal instruction

Hi,I have a fortran program which I have been compiling for years without problems on g95, gfortran and lahey. Now I try on intel and i get the error message "Illegal instruction"I compile with:ifort AlphaPhase.f90 -fast -O3 -m64 -o AlphaPhase1.1I have narrowed down the problem to where I do a matrix multiplication:MarkerNRM=matmul(GenosR,transpose(GenosR))Is it a stackpace issue?Can you advise?Regards,John Hickey.

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

> Is it a stackpace issue?
Possibly; however, there are many other possible causes of the problem.> Can you advise?
We need to see the code (preferably, a small and complete example that can be compiled and run) first. Which OS are you on, and which version of the compiler did you use? Does the error occur only with the compiler options that you displayed?

You may want to try removing flags one at a time, especially the O3 and fast flags. Since very aggressive optimisations are performed for MATMUL(), try executing with O0 and then you'll know whether an optimisation is going wrong or if there is some other problem. As mentioned above, it would be very helpful to provide a small reproducing program.

Are you running the program on the same system where you compile it? -fast implies -arch host, which means use the instruction set for the CPU you compiled on. Don't use this if you are running the program somewhere else. You can add a -x option that is correct for the compiling and target systems.

Retired 12/31/2016


I assume you are on Mac for 2 reasons: 1, illegal instruction on Mac OS is the same as sigsegv on Linux. 2, you use -m64 which is a Mac compiler option.

Yes, this is probably a stack problem:

Macs are a bit more difficult, as ulimit -s on Mac OS will only unlimit up to the 64MB: ulimit -s 65532. After that, you'll need the to use the linker via the -Wl option above to increase it further.

You may try to split out the matmul into 2 statement:

transR = transpose(GenosR)
MarkerNRM = matmul( GenosR,transR )

The use of transpose(GenosR) inside another function call is sure to create an array temporary the size of GenosR on stack. The way I've coded it above in 2 steps avoids the stack, at the expense of a temporary array transR that will be heap allocated. It's worth a try.


Recently we are experiencing a similar problem with our Fortran 90 codes. Using the same MakeFile and source code two executables were created, one with ifort 12.1.2 and the other with ifort 13.01. The firs executable seemingly works OK on a number of computers, the second one fails with the "illegal instruction" error. What compiler switches should be used to get around this problem using the more recent compiler?

What command line are you using to compile and which specific model of CPU does the problem computer have? My guess is that you are using a -m option specifying an instruction set not supported on the problem computer.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today