------- Comment #11 from burnus at gcc dot gnu dot org 2010-07-16 09:11 ------- Seemingly, we currently only "recycle" DECLs for procedure decls, but not for module variable decls.
Looking at gfortran -fdump-tree-optimized-all -O3 char_array_structure_constructor.f90 one finds (grep MOD_c): __global_MOD_cD.1586 __global_MOD_cD.1606 However, if one removes the second "USE global" and uses the host-associated variable, it works (i.e. there is only one "__global_MOD_cD"). Expected: The same DECL is used for host associated variables - and, at least with -fwhole-file, the same DECL is used for the whole file. I wonder whether the same problem also exists for COMMON symbols. (Note: While the wrong-code only becomes apparent on x86_64-apple-darwin10, the bug itself exists on all platforms. Thus, I have emptied the PR's target field.) -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu dot org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC build triplet|x86_64-apple-darwin10 | GCC host triplet|x86_64-apple-darwin10 | GCC target triplet|x86_64-apple-darwin10 | Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2010-07-16 09:11:44 date| | Summary|[4.6 Regression] FAIL: |[4.6 Regression] Wrong decl |gfortran.dg/char_array_struc|for module vars / FAIL: |ture_constructor.f90 |gfortran.dg/char_array_struc | |ture_constructor.f90 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44945