Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Important Update: Community Platform Migration​. Learn more​>

items in common are zero

jameshart
Beginner
1,412 Views
We are new to the Compaq Visual Fortran (CVF) Compiler and have found something that we can't explain. We are merging 2 programs together with all data transfer between them via a shared common block. We are linking an object (from Program A) provided by CVF developer A with another 3 objects from Program B provided by CVF developer B. The developers do not share their source code. As noted, the programs share a common block (via include) which contains all of the variables needed to pass back and forth between programs. The group A and B objects are linked by CVF developer A and an program executable is created. Upon execution, Program A initializes two variables in the shared common (an integer*4 and a character*180) to specific non-zero values, then calls Program B as a subroutine. When Program B prints these variables, they are both zero (as if they have been reset to zero).

We have done some similar tests linking 2 small test program object files with this same ?shared common? method of passing variables and it seems to work fine. Developer A has also successfully tested this approach using a small callable ?dummy? version of Program B (that returns some dummy variables back just like Program B would have). Similarly, Developer B has successfully tested this approach using a small dummy ?caller? version of Program A (that sends some dummy variables like Program A would have).

Has anyone encountered this before? What could we be missing? Any ideas/suggestions are welcome.

Thanks.

Jim
0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,412 Views
Here's what I would do. In "program A", print out LOC(common-variable-name). In "program B", do the same. See if you get the same value printed in both parts of the application. If you don't, then a link map, searching for the common name, might be enlightening.

Either your two parts of the program really aren't sharing the common, or your code violates the Fortran standard in a way that makes the compiler think it doesn't need to fetch from the common (for example, if you pass the common variable as an argument and reference it both ways.)

I wonder if the two sets of objects are being compiled with different switch settings - for example, if one was compiled with /names:lowercase and the other wasn't, you'd get two sets of commons. The link map would tell you this. (Project..Settings..Link..Generate map file)

Steve
0 Kudos
jameshart
Beginner
1,412 Views
Steve;

Some of the parameters used to size things in the common from program A were different than those used to size things in the common for program B - whiched caused a major misalignment.

Also, we did have to change to /names:lowercase.

Thanks for your suggestions.

Jim
0 Kudos
Reply