Problems to compile fortran and C++ programs

Problems to compile fortran and C++ programs

I'm using fortran and C++ to write my programs. I'm using C++ to allocate memory and fortran to do the work.
I compile my program without any error massages, but when I try to run the program stop whit this messages:

** Illegal Instruction **
End of diagnostics

Do you have any suggestion of what I need to look for to find the error?

The break point depends of level of optimization

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

What switches are you using for the compilation and what kind of processor are you running on? The most common cause of an "illegal instruction" error is using one of the architecture-specific code generation options (-QxW, for example), but running on a processor that doesn't support that instruction set.


Retired 12/31/2016

Thanks a lot for your answer.
I'm running on a Pentium III CPU family 1133MHz with cache size : 512 KB, under Red Hat Linux 7.1.
In my makefile I use this options:
-tpp6 -xKW -ip -w -I/usr/include -Vaxlib -lm
with the option -O3 or -O0

Do you think that there are some problems with this options?


Replace -xKW with -xK and see what happens. I'm still a bit fuzzy on how -x with multiple target codes works. I think -axKW would work and do auto-dispatch.


Retired 12/31/2016

It works!
The problem was that I used the option -xKW, when I follow your suggestion, i.e., replace -xKW with -xK or -axKW the program run correctly.

I still have a gap when I compare the performance betwen GNU and Intel compiler

GNU compiler: real time 0m39.583s
Compile options: -fno-globals -Wno-globals -O3

Intel compiler: real time 0m47.497s
Compile options: -tpp6 -axKW -ip -w -Vaxlib -O3

At least works!
Now I can try optimize the source code for Intel compiler.


-xK will give you somewhat better performance than -axKW.

Explanation: -xKW basically told the compiler to assume Pentium 4 instructions (the K was ignored). -xK says assume Pentium III.

-axKW says to generate code that automatically detects the CPU type and dispatches to one of three different code sets, generic, Pentium III and Pentium 4. This may slow down a program somewhat.


Retired 12/31/2016

Leave a Comment

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