[Bug c/24109] New: [4.0 Regression] -fno-unit-at-a-time failure with compound literals

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Sep 28 20:30:00 GMT 2005


The PR23190 fix on gcc-4_0-branch introduced a regression, which leads
to not being able to load some Linux kernel modules which abuse compound
literals.

Short testcase:
extern void abort (void);

struct A { int i; int j; };
struct B { struct A *a; struct A *b; };
struct C { struct B *c; struct A *d; };
struct C e = { &(struct B) { &(struct A) { 1, 2 }, &(struct A) { 3, 4 } },
&(struct A) { 5, 6 } };
int
main (void)
{
  if (e.c->a->i != 1 || e.c->a->j != 2)
    abort ();
  if (e.c->b->i != 3 || e.c->b->j != 4)
    abort ();
  if (e.d->i != 5 || e.d->j != 6)
    abort ();
  return 0;
}

At -O0, -O1 or say -Os -fno-unit-at-a-time, this results in undefined
__compound_literal.[01] symbols.
The problem doesn't reproduce on HEAD, which has the PR23190 fix as well.

-- 
           Summary: [4.0 Regression] -fno-unit-at-a-time failure with
                    compound literals
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,mark at codesourcery dot
                    com,rth at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list