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

Possible Scope Bug in ifort 11.1 20091130??

david_car
New Contributor I
810 Views

Hi All,

At the moment I really don't know how to explain this without you having all the code and the makefile. So I've attached a tarball with the code and makefile. Simply untar it; cd into the bug directory and do 'make'. Everything compiles just fine, but complains in the link phase with:

obj/class_Pair_String_integer.o:(.bss+0x480): multiple definition of `SETUP$BLK.var$179'
obj/class_Pair_integer_integer.o:(.bss+0x468): first defined here
ld: Warning: size of symbol `SETUP$BLK.var$179' changed from 12 in obj/class_Pair_integer_integer.o to 140 in obj/class_Pair_String_integer.o
obj/class_String.o:(.data+0xde8): multiple definition of `SETUP$BLK.var$244'
obj/class_HashTable_Srn_LitSrn_Lit.o:(.data+0xc48): first defined here

The strange thing is that the SETUP function is within a contains block of init* functions (* meaning wildcard) of the modules and so should only be within those scopes. Both pgfortran and gfortran compile this without a problem. I haven't tried g95 yet. Any ideas? Many thanks in advance.

-David

0 Kudos
6 Replies
david_car
New Contributor I
810 Views

Ok. Tried the g95 compiler and no problems with the build. Any help is greatly appreciated. Thanks.

-David

0 Kudos
Steven_L_Intel1
Employee
810 Views
Thanks - I can reproduce this. Investigating now.
0 Kudos
Steven_L_Intel1
Employee
810 Views

I have escalated this as issue DPD200150915.

The problem occurs when a contained routine does an ALLOCATE of a derived type variable that has initializers. The compiler generates a chunk of data which it will copy in as the initial value and assigns it a global name. Unfortunately, it chooses the name of the contained routine to "qualify" the global name rather than that of the outermost scope, and this is not guaranteed to be unique.

Given your use of include files to construct these routines, I'm not sure what I can suggest as a workaround.

I will update this thread when I hear it has been fixed.

0 Kudos
david_car
New Contributor I
810 Views
Thanks Steve. Makes sense now. I couldn't figure out why SETUP (the name of the contained routine) was a data section in the object code. Looking forward to the fix.
0 Kudos
Steven_L_Intel1
Employee
810 Views
David,

This is fixed for our next major release, due late this year.
0 Kudos
david_car
New Contributor I
810 Views
Hi Steve,
Thanks for the update. Looking forward to that release.
0 Kudos
Reply