Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29252 ディスカッション

Possible Scope Bug in ifort 11.1 20091130??

david_car
新規コントリビューター I
825件の閲覧回数

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 件の賞賛
6 返答(返信)
david_car
新規コントリビューター I
825件の閲覧回数

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

-David

Steven_L_Intel1
従業員
825件の閲覧回数
Thanks - I can reproduce this. Investigating now.
Steven_L_Intel1
従業員
825件の閲覧回数

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.

david_car
新規コントリビューター I
825件の閲覧回数
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.
Steven_L_Intel1
従業員
825件の閲覧回数
David,

This is fixed for our next major release, due late this year.
david_car
新規コントリビューター I
825件の閲覧回数
Hi Steve,
Thanks for the update. Looking forward to that release.
返信