This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/14218] New: Failure of gcc.c-torture/execute/920501-5.c


The following piece of code fails on tree-ssa with -O. It is
derived from gcc.c-torture/execute/920501-5.c but the code below
fails with -O, the original testcase fails only with -Os.

x (int i)
{
  void * const j[] = {&&x, &&y, &&z};
  goto *j[i];
 x:return 2;
 y:return 3;
 z:return 5;

}
main ()
{
  if (x (0) != 2 || x (1) != 3 || x (2) != 5)
    abort();
  exit(0);
}

 $ gcc -O 920501-5.c
 /tmp/ccQlbmtB.o(.rodata+0x0): undefined reference to `.LL2'
 /tmp/ccQlbmtB.o(.rodata+0x4): undefined reference to `.LL3'
 /tmp/ccQlbmtB.o(.rodata+0x8): undefined reference to `.LL4'
 collect2: ld returned 1 exit status

 gcc version 3.5-tree-ssa 20040216 (merged 20040211)
 SunOS theseus 5.9 Generic_112233-08 sun4u sparc SUNW,Ultra-4

The actual problem is in gimplify.c. There are cases, where we fail
to call gimplify_expr on the elements of the array-initializer (aka
CONSTRUCTOR). But this would be necessary to set the FORCED_LABEL flag
on the labels in function x. The missing flag makes tree-cfg.c believe
that everything after the goto is unreachable.

    regards  Christian

-- 
           Summary: Failure of gcc.c-torture/execute/920501-5.c
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ehrhardt at mathematik dot uni-ulm dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]