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?