Commit ecf92f82 by Eric Botcazou Committed by Eric Botcazou

re PR c/7741 (ICE on conflicting types (make_decl_rtl at varasm.c:834))

	PR c/7741
	* c-decl.c (duplicate_decls): Discard the initializer of the
	new decl when the types are conflicting.

Co-Authored-By: Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>

From-SVN: r62631
parent ac5e69da
2003-02-10 Eric Botcazou <ebotcazou@libertysurf.fr>
Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
PR c/7741
* c-decl.c (duplicate_decls): Discard the initializer of the
new decl when the types are conflicting.
2003-02-10 Josef Zlomek <zlomekj@suse.cz> 2003-02-10 Josef Zlomek <zlomekj@suse.cz>
* Makefile.in (sreal.o): Added. * Makefile.in (sreal.o): Added.
......
...@@ -1140,6 +1140,12 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1140,6 +1140,12 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
} }
} }
error_with_decl (olddecl, "previous declaration of `%s'"); error_with_decl (olddecl, "previous declaration of `%s'");
/* This is safer because the initializer might contain references
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;
} }
/* TLS cannot follow non-TLS declaration. */ /* TLS cannot follow non-TLS declaration. */
else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL
......
2003-02-10 Eric Botcazou <ebotcazou@libertysurf.fr>
Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
* gcc.dg/decl-2.c: New test.
Mon Feb 10 11:41:20 CET 2003 Jan Hubicka <jh@suse.cz> Mon Feb 10 11:41:20 CET 2003 Jan Hubicka <jh@suse.cz>
* gcc.dg/i386-fpcvt-1.c: New test. * gcc.dg/i386-fpcvt-1.c: New test.
......
/* PR c/7411 */
/* Contributed by Christian Ehrhardt */
/* { dg-do compile } */
void foo(void)
{
char c; /* { dg-error "previous declaration" } */
int i;
int c = i; /* { dg-error "conflicting types" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment