This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[incremental] Patch: FYI: handle null binding in duplicate_decls
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 14 Dec 2007 08:46:38 -0700
- Subject: [incremental] Patch: FYI: handle null binding in duplicate_decls
- Reply-to: Tom Tromey <tromey at redhat dot com>
I'm checking this in on the incremental-compiler branch.
The 'binding' argument to duplicate_decls can be NULL. This happens
with the 20041005-1.c test case. We didn't account for this, causing
a crash.
This patch fixes the problem and lets us pass a few more tests.
Tom
ChangeLog:
2007-12-14 Tom Tromey <tromey@redhat.com>
* c-decl.c (pushdecl): Pass NULL directly to duplicate_decls.
(duplicate_decls): Check for non-NULL binding.
Index: c-decl.c
===================================================================
--- c-decl.c (revision 130776)
+++ c-decl.c (working copy)
@@ -2113,7 +2113,8 @@
since we do not want to smash any generally visible (and
reusable) decl. FIXME: should make just one duplicate for
both scopes. */
- if ((B_IN_FILE_SCOPE (binding) || B_IN_EXTERNAL_SCOPE (binding))
+ if (binding
+ && (B_IN_FILE_SCOPE (binding) || B_IN_EXTERNAL_SCOPE (binding))
&& !object_in_current_hunk_p (olddecl))
{
/* Modify a copy of OLDDECL and install that in the
@@ -2461,7 +2462,7 @@
}
else if (TREE_PUBLIC (x))
{
- if (visdecl && !b && duplicate_decls (x, visdecl, b))
+ if (visdecl && !b && duplicate_decls (x, visdecl, NULL))
{
/* An external declaration at block scope referring to a
visible entity with internal linkage. The composite