[Bug c/24830] New: Duplicate constructors with -fmudflap

dgraham at nortel dot com gcc-bugzilla@gcc.gnu.org
Sun Nov 13 04:05:00 GMT 2005


The only way I know how to reproduce this is with -fmudflap, but
that's only because *C* code doesn't normally generate constructors.

With -fmudflap, each of the mudflap constructors are run twice.  An objdump
run on the object files shows two ctor sections, one named ".ctor" and
one named ".ctor.65436".  default_named_section_asm_out_constructor() is
being called twice from cgraph_build_static_cdtor(), once directly, and
once indirectly.  The first (indirect) call is here:

#0  default_named_section_asm_out_constructor (symbol=0xb7a5a660,
priority=65535)
    at ../../gcc-4.0.2.bounds/gcc/varasm.c:1133
#1  0x0805b237 in c_expand_body (fndecl=0xb7a45dec)
    at ../../gcc-4.0.2.bounds/gcc/c-decl.c:6634
#2  0x0832f012 in cgraph_expand_function (node=0xb7a45f30)
    at ../../gcc-4.0.2.bounds/gcc/cgraphunit.c:835
#3  0x0832f0f5 in cgraph_assemble_pending_functions ()
    at ../../gcc-4.0.2.bounds/gcc/cgraphunit.c:307
#4  0x0832f78a in cgraph_finalize_function (decl=0xb7a45dec, nested=0 '\0')
    at ../../gcc-4.0.2.bounds/gcc/cgraphunit.c:399
#5  0x083309ae in cgraph_build_static_cdtor (which=73 'I', body=0xb7a5a660,
priority=99)
    at ../../gcc-4.0.2.bounds/gcc/cgraphunit.c:1901
#6  0x080941a2 in mudflap_finish_file () at
../../gcc-4.0.2.bounds/gcc/tree-mudflap.c:1374
#7  0x082eea55 in toplev_main (argc=3081086560, argv=0xbfb75a84)
    at ../../gcc-4.0.2.bounds/gcc/toplev.c:1050

The second (direct) call is here:

#0  default_named_section_asm_out_constructor (symbol=0xb7a5a660, priority=99)
    at ../../gcc-4.0.2.bounds/gcc/varasm.c:1133
#1  0x08330997 in cgraph_build_static_cdtor (which=73 'I', body=0xb7a5a660,
priority=99)
    at ../../gcc-4.0.2.bounds/gcc/cgraphunit.c:1911
#2  0x080941a2 in mudflap_finish_file () at
../../gcc-4.0.2.bounds/gcc/tree-mudflap.c:1374
#3  0x082eea55 in toplev_main (argc=3081086560, argv=0xbfb75a84)
    at ../../gcc-4.0.2.bounds/gcc/toplev.c:1050

The first call looks wrong, as it is not being passed the correct
priority.

--Doug.


-- 
           Summary: Duplicate constructors with -fmudflap
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dgraham at nortel dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24830



More information about the Gcc-bugs mailing list