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

Assignment statement doesn't "stick" in Release version

Randal_Guendel
Beginner
727 Views

I've been working with some older code (mostly F77)and IVF 11.1.065, and I noticed that some of the data outputwas zero when it shouldn't be. I recompiled as a Debug version and discovered that theproblem disappeared. Using output to the screen, I traced the problem in the Release version to a simple assignment statement that doesn't seem to stick--if b is non-zero, the assignment a=b leaves aas zero. In my case, both variables aredouble precision arrays stored in common blocks, and I'm trying to store a single element from b in a.

I further discovered that if I write out the contents of a and bbefore making the assignment, the problem goes away.Thinking that something might be going on in optimization, I tried disabling the optimization (from /O2) and indeed the problem goes away; however, the penalty in runtime was pretty stiff. I popped the optimzation up to /O1 and the problem returned.

I'm compiling with the /Qsave option, but I tried explicitly saving the relevantcommon blocks with no success. I also tried updating to build70 after seeing a note aboutskipped assignment statements, but again no luck.

Any ideas about what mightbe going wrong? Thanks!

0 Kudos
3 Replies
Steven_L_Intel1
Employee
727 Views
You'd have to show us a test case. More likely it's something else overwriting your variable due to coding errors somewhere in the program. Have you tried the current version (12.0.2)?
0 Kudos
Randal_Guendel
Beginner
727 Views
Thanks, the new version seems to have done the trick. Would you suspect that there is still a coding error lurking somewhere that the new version has just done a better job compensating for, or was there a fixsince v11.1.070 that might have had some bearing on my issue?

Randal
0 Kudos
Steven_L_Intel1
Employee
727 Views
I have no way of knowing if there was some specific fix that helped, nor if there is a coding error that simply is masked now. At this point I suggest just carrying on.
0 Kudos
Reply