06-20-2006 11:44 AM
06-20-2006 03:04 PM
Hello,
This does indeed to be a problem to me. I have created an error report and sent it to our CVI R&D department for them to investigate (CAR number 3YJDRG3A).
I worked off your example and created another example that
demonstrates that this problem only occurs when the static local is on the RHS
of the ‘+’. It also works OK when the
variable is declared as a module global:
#include <ansi_c.h>
#include <cvirte.h>
static __int64 module_global;
int main (int argc, char *argv[])
{
__int64 a;
static __int64 b;
__int64 c;
__int64 d;
__int64 * pInt64 = malloc (sizeof (__int64));
a = 1;
b = 2;
c = 3;
*pInt64 = 4;
d = a + b; //GPF - static local var is used on RHS of '+' operator
d = b + a; //OK
d = a + module_global; //ok
d = module_global + a; //ok
d = a + c;
d = c + a;
c = a + *pInt64; //ok
b = c + a; //ok
return 0;
}
At any rate, I do apologize for any problems this may have caused you (as debugging a subtle error like this could take a long time), and I hope that we can find a way to work around the problem.
Thanks for posting!
06-20-2006 03:26 PM
06-21-2006 04:41 PM
Hello Menchar,
Again, I sincerely apologize for the trouble this undoubtedly caused! As programmers we would like to assume that the compiler is completely free of problems. If we make this assumption, then, when we encounter crashes we naturally assume that it’s our code (and 99.99999999% we’re right) and begin debugging from there. When the compiler is to blame it leads to frustrating debugging like you surely experienced yesterday. I linked this post to the bug report filed, so the developers will see your request. You are also welcome to submit your own product suggestion that goes directly to our R&D department. Feel free to visit http://sine.ni.com/apps/utf8/nicc.call_me and select “product feedback”.
Thanks again for pointing out the problem, and apologies for the trouble!