Test program:

struct foo 
{
    int i;
};

int bar (void)
{
    return ((struct foo *)0x1234)->i;
}

Compile with -g; readelf does NOT show a definition of "struct foo" in the debug
data.

If I compile with  -fno-eliminate-unused-debug-types, the definition does
appear, but in the example program, foo isn't "unused".

-- 
           Summary: referencing a type via a cast does not emit it for debug
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pkoning at equallogic dot com
                CC: gcc-bugs at gcc dot gnu dot org
 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=21391

Reply via email to