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 c/14036] New: tree-ssa gcc ICEs on redeclaration of local externs to global declaration


Following test case ICEs on tree-ssa gcc with -O2. A possible patch is attached. With this patch.
gap program of the SPEC benchmark compiles with -O3 and IMI (which uncovered this bug). 
I have not run any other tests at this time.

void first ( )
{
  extern char         In;
}

void second ()
{
  extern char         In;
}

char         In;

mygccf5 -O2 -c gap.c
gap.c: In function `first':
gap.c:2: internal compiler error: in expand_var, at expr.c:6240
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

And here is my proposed patch:

Index: c-decl.c
============================================================
=======
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.334.2.79
diff -c -p -r1.334.2.79 c-decl.c
*** c-decl.c    30 Jan 2004 13:13:31 -0000      1.334.2.79
--- c-decl.c    5 Feb 2004 23:23:22 -0000

*************** pushdecl (tree x)
*** 1712,1717 ****
--- 1731,1738 ----
                    break;
                  }
            }
+         else
+           old = copy_node (old);
          return old;
        }
        if (DECL_EXTERNAL (x) || scope == global_scope)

-- 
           Summary: tree-ssa gcc ICEs on redeclaration of local externs to
                    global declaration
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fjahanian at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: gcc -c -O2 gap.c
  GCC host triplet: ppc apple darwin
GCC target triplet: ppc apple darwin


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


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