This is the mail archive of the
mailing list for the GCC project.
[incremental] Patch: FYI: two binding fixes
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 21 Dec 2007 11:15:01 -0700
- Subject: [incremental] Patch: FYI: two binding fixes
- Reply-to: Tom Tromey <tromey at redhat dot com>
I'm checking this in on the incremental-compiler branch.
This fixes a couple of binding-related bugs.
One is due to the changes in how the C FE works. When the middle end
calls the pushdecl langhook, we don't have a scope, so eventually we
ICE. The fix here is to do nothing -- just return the decl. I think
we should probably not call the pushdecl langhook at all in the middle
end, but I don't know how this would impact the other front ends, so I
opted for the localized fix.
The other fix lets us handle certain scoping cases properly. If we're
defining a structure tag in a local scope, I think we don't want to
record an anti-dependency against the file scope. This is sort of a
tricky area, I made a note to look at it a bit more.
With this, the branch is down to 144 test suite failures. This is
pretty good considering there were 1000 a week ago :-)
2007-12-21 Tom Tromey <firstname.lastname@example.org>
* c-decl.c (lookup_tag): Only record anti-dependency at file
(pushdecl): Do nothing if no external scope available.
--- c-decl.c (revision 131030)
+++ c-decl.c (working copy)
@@ -2267,6 +2267,13 @@
struct c_binding *b;
bool nested = false;
+ /* If there is no scope, do nothing. This is here to handle calls
+ to the pushdecl langhook from the middle-end, after we've popped
+ all the scopes and stopped parsing. FIXME: these calls should go
+ away. */
+ if (external_scope == NULL)
+ return x;
/* Functions need the lang_decl data. */
if (TREE_CODE (x) == FUNCTION_DECL && !DECL_LANG_SPECIFIC (x))
DECL_LANG_SPECIFIC (x) = GGC_CNEW (struct lang_decl);
@@ -2893,7 +2900,10 @@
if (thislevel_only && !thislevel)
- c_parser_lookup_callback (name, NULL_TREE, true);
+ /* In this case, only record an anti-dependency if we are in
+ file-scope. */
+ if (current_scope == file_scope)
+ c_parser_lookup_callback (name, NULL_TREE, true);