This is the mail archive of the gcc-patches@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]

[PATCH] Fix PR c/9928


Hi,

This is an ICE on illegal code, regression from GCC 3.2.2 present on all 
active branches. It appears that my previous patch for PR c/7741 was a bit 
gross: http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00641.html

Compiled (this is error-recovery material) and regtested on 
i586-redhat-linux-gnu (c 3.2 branch). Ok for mainline and 3.3? Ok for 3.2?

-- 
Eric Botcazou


2003-03-11  Eric Botcazou  <ebotcazou at libertysurf dot fr>

	PR c/9928
	* c-decl.c (duplicate_decls): Discard the initializer of the new decl
	only if it is a VAR_DECL.

2003-03-11  Eric Botcazou  <ebotcazou at libertysurf dot fr>

	* gcc.dg/decl-3.c: New test.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.300.2.10.2.6
diff -u -p -r1.300.2.10.2.6 c-decl.c
--- c-decl.c	10 Feb 2003 13:01:49 -0000	1.300.2.10.2.6
+++ c-decl.c	11 Mar 2003 17:09:49 -0000
@@ -1670,7 +1670,8 @@ duplicate_decls (newdecl, olddecl, diffe
 	 to variables that were declared between olddecl and newdecl. This
 	 will make the initializer invalid for olddecl in case it gets
 	 assigned to olddecl below.  */
-      DECL_INITIAL (newdecl) = 0;
+      if (TREE_CODE (newdecl) == VAR_DECL)
+	DECL_INITIAL (newdecl) = 0;
     }
   else
     {
/* PR c/9928 */
/* { dg-do compile } */

enum { CODES }; /* { dg-error "previous declaration" } */
enum { CODES }; /* { dg-error "conflicting types" } */

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