This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jul 2010 09:32:05 -0000
- Subject: [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls
- References: <bug-45087-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from burnus at gcc dot gnu dot org 2010-07-28 09:32 -------
Patch. It fixes also test_fpu.f90 - however, for gas_dyn.f90 it causes a
segfault:
==24597== Invalid read of size 8
==24597== at 0x5A8DF3: ggc_set_mark (ggc-page.c:600)
==24597== by 0x73CD54: gt_ggc_mx_eh_status (gtype-desc.c:714)
==24597== by 0x73DA25: gt_ggc_mx_function (gtype-desc.c:943)
==24597== by 0x553410: gt_ggc_mx_lang_tree_node (gt-fortran-f95-lang.h:293)
==24597== by 0x73D94D: gt_ggc_m_P9tree_node4htab (gtype-desc.c:2544)
==24597== by 0x553EAD: gt_ggc_m_P17module_htab_entry4htab
(gtype-fortran.h:98)
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 162619)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -1409,7 +1409,7 @@ gfc_get_extern_function_decl (gfc_symbol
gsym = gfc_find_gsymbol (gfc_gsym_root, sym->name);
if (gfc_option.flag_whole_file
- && !sym->attr.use_assoc
+ && (!sym->attr.use_assoc || sym->attr.if_source != IFSRC_DECL)
&& !sym->backend_decl
&& gsym && gsym->ns
&& ((gsym->type == GSYM_SUBROUTINE) || (gsym->type == GSYM_FUNCTION))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45087