- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I would like to optimize my code while catching the exception sqrt of negative numbers. I thought setting -fpe0 would ensure this but optimizations seem to override this. Playing with compilation options fo the test progam below, I found that:
ifort -O0 -fpe0 test.f produces forrtl error of sqrt(-1.9)
ifort -O1 -fpe0 test.f does not produce forrtl error (result prints as NaN)
ifort -O2 -fpe0 test.f does not produce forrtl error
ifort -O{n} test.f does not produce forrtl error
So, -fpe0 only works with -O0? Any suggestions on how to catch this error at higher optimization levels?
Thanks for any help.
Jonathan
ia64, Linux RH Enterprise 3, ifort 8.1.021 or ifort 9.0.031
Simple test progam follows:
=====================
program TEST
implicit none
real dx,dy
dy = -1.952034
dx = sqrt(dx)
write(0,*) dx,dy
stop
end
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just adding some more info:
- ifort -mp -fpe0 test.f produces a forrtl erorr (but a different statement than -O1 -fpe0 does -- getRegFromUnwindContext: Can't get Gro from UnwindContext)
- ifort -mp -O0test.t does not producean error!
The User's Guide isn't clear what is happening with -mp other than the line "compile-time floating-pointarithmetic is not performed to ensure that floating-point exceptions are also maintained"...but example #2 seems like this is incorrect?

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