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]

[incremental] Patch: FYI: two binding fixes


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 :-)

Tom

ChangeLog:
2007-12-21  Tom Tromey  <tromey@redhat.com>

	* c-decl.c (lookup_tag): Only record anti-dependency at file
	scope.
	(pushdecl): Do nothing if no external scope available.

Index: c-decl.c
===================================================================
--- 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);
       return 0;
     }
 


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