- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I just installed the latest Intel Fortran compiler (noncommercial) on a Ubuntu 9.04 system (running w/ AMD64). I'm pretty new to ifort, and I'm not sure why I'm unable to stop floating point exceptions.
Example program:
program test
implicit none
real :: a, b
a = 0.0
b = 0.0
print *, a/b
end progam test
If I compile this using
>>$ ifort -fpe0 test.f90 -o testx
I would expect execution to halt and declare an exception, but it doesn't and simply prints NaN.
Any suggestions?
Example program:
program test
implicit none
real :: a, b
a = 0.0
b = 0.0
print *, a/b
end progam test
If I compile this using
>>$ ifort -fpe0 test.f90 -o testx
I would expect execution to halt and declare an exception, but it doesn't and simply prints NaN.
Any suggestions?
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - jaroberts2
program test
implicit none
real :: a, b
a = 0.0
b = 0.0
print *, a/b
end progam test
I would expect execution to halt and declare an exception, but it doesn't and simply prints NaN.
In certain past Unix-like operating systems, you might capture run-time exceptions without invoking IEEE_EXCEPTIONS, by running under debugger with specific options set, but I fear there is no exact equivalent available in linux. Anyway, you would be searching for exceptions raised at run time, not at compile time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
In this case, you would expect the compiler to evaluate a/b as NaN (non-signaling?), regardless of any run time behavior you attempt to set.
In certain past Unix-like operating systems, you might capture run-time exceptions without invoking IEEE_EXCEPTIONS, by running under debugger with specific options set, but I fear there is no exact equivalent available in linux. Anyway, you would be searching for exceptions raised at run time, not at compile time.
In certain past Unix-like operating systems, you might capture run-time exceptions without invoking IEEE_EXCEPTIONS, by running under debugger with specific options set, but I fear there is no exact equivalent available in linux. Anyway, you would be searching for exceptions raised at run time, not at compile time.
Ah, I should have been a bit clearer. I expected the exception (NaN) at run time. I get the expected behavior when I compile the same using gfortran with the -ffpe-trap=invalid flag. I did test the same code on another linux machine (I'm not sure of the exact breed nor the exact ifort version) and it also gave the exception.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - jaroberts2
I expected the exception (NaN) at run time. I get the expected behavior when I compile the same using gfortran with the -ffpe-trap=invalid flag. I did test the same code on another linux machine (I'm not sure of the exact breed nor the exact ifort version) and it also gave the exception.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
Did you perhaps not set -O when you used gfortran? Remember that ifort defaults to -O2, and there is aggressive compile-time constant propagation, while gfortran defaults to -O0.
Is there anything else I might be missing?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page