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

NaN with -O2 and above, expected results with -O1 and below

Izaak_Beekman
New Contributor II
4,284 Views

Hi I have a non-trivial, object-oriented statistics library to calculate statistical moments (and co-moments) in a numerically robust fashion, implementing the algorithms described in http://infoserve.sandia.gov/sand_doc/2008/086212.pdf. I have taken great care to implement numerically robust algorithms. However, when I compile my code with -O2 and above something happens that causes NaNs in one of the routines while -O1 and -O0 give the correct, expected results. Additionally compiling with the -check flag gives the expected results, however, I think -check disables a lot of the optimization. I tried to compile with -opt-report and didn't notice anything suspicious in the offending routine. Further more, adding flags like -standard-semantics (which adds -assume protect_parens -assume realloc_lhs etc. to help diagnose potential error sources) does not fix anything. I am suspecting that the optimization algorithm has an error/bug of some variety. Perhaps, either new OO Fortran invalidates one of the assumptions/checks of the optimizer or there is some other compiler bug. I am tempted to submit this to premier.intel.com, but I will have to send them the whole project, as I cannot find a way to reproduce this error with a simpler program/code.

Has anyone had similar experiences? Could this be "correct" behaviour of the compiler? (produce NaNs for -O2 and up while -O1 and below run fine?) Should I submit the whole project to premier support?

Thanks

0 Kudos
1 Solution
Steven_L_Intel1
Employee
4,287 Views

Issue ID is DPD200247629. I can reproduce this on both IA-32 and Intel 64 with our latest in-house compiler. I will update this thread with any developments.

View solution in original post

0 Kudos
24 Replies
Izaak_Beekman
New Contributor II
839 Views

Thanks Steve. I'm sorry it took me so long to get together a simple reproducer code. Also, I'm glad I'm not (completely) crazy, and that this issue has been successfuly reproduced. If it gets escalated please let me know what the issue/problem report number is so I can follow its resolution.

0 Kudos
Steven_L_Intel1
Employee
4,288 Views

Issue ID is DPD200247629. I can reproduce this on both IA-32 and Intel 64 with our latest in-house compiler. I will update this thread with any developments.

0 Kudos
Izaak_Beekman
New Contributor II
839 Views

Just curious if the problems with optimization and associate have been fixed, or are planned to be fixed in a forthcoming release.

0 Kudos
Steven_L_Intel1
Employee
839 Views

Sorry for missing this - it was fixed in Update 2.

0 Kudos
Reply