• No replies
1 Post

Pinned topic Application crash with constants calculated during runtime initalization

‏2012-06-14T23:05:40Z |
We're having a reproducible problem when trying to execute one of our 32-Bit Windows applications (built with VS2010, running on a 64-bit Win7 machine, Purify version is 7.0.1-001 Build 11785) under Purify. The problem only occurs with a release build (all settings as per the suggested settings, doesn't matter if optimization is turned off or on).

Basically, a floating point constant which is declared as a global constant and is initialized by calling a floating point function will reliably result in the application exiting with an access violation in said function in the MSVC runtime library. It doesn't really matter which of the functions we call, so far I can easily reproduce it with cos(), pow() and log10(). This happens if the constant is initialized in a DLL or in the main executable.

Running a debug build of the same executable works fine, but our debug builds are pretty slow and combining this with the overhead incurred by Purify makes the executable almost un-Purify-able.

The problem is triggered by having a global constant like this:

double const test1 = pow(10 * 1.352, 15);

Constant initializations that simply use constants work.

Moving the above line into a function works around the problem, but that is not really a workaround for us as we are using several third party libraries that have similar constant initializers and trying to get these changed is not an option.

Has anybody encountered this issue before and is there a known workaround that preferably doesn't require changes to the source code?