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]

Re: Patch: PR 17408/17409



On Sep 11, 2004, at 12:45 PM, Joseph S. Myers wrote:


On Sat, 11 Sep 2004, Dale Johannesen wrote:

Having now read what the standard requires (which seems poorly chosen,
but it's Too Late Now), getting all cases right seems messy. Setting
DECL_EXTERN on an initialized object obviously leads to trouble, and
is contrary to the meaning of that flag. I'm now thinking in terms of
adding a bit, which tells whether an initialized object was defined using
'extern' or not. The code that resolves

For the present bugs, there is probably a reasonably straightforward local
fix. DECL_EXTERNAL should end up getting reset in start_decl.
Investigate what's going wrong.

Right you are. The Static bit was getting clobbered by pushdecl, apparently the
Extern bit confused it. The following fixes pr15360-1.c and the examples in both
newer PRs. I'll start a test run, OK if that looks all right?


Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.579
diff -u -d -b -w -p -r1.579 c-decl.c
--- c-decl.c 10 Sep 2004 23:56:24 -0000 1.579
+++ c-decl.c 13 Sep 2004 17:44:37 -0000
@@ -2981,8 +2981,11 @@ start_decl (struct c_declarator *declara
TEM may equal DECL or it may be a previous decl of the same name. */
tem = pushdecl (decl);


-  if (initialized)
+  if (initialized && DECL_EXTERNAL (tem))
+    {
     DECL_EXTERNAL (tem) = 0;
+      TREE_STATIC (tem) = 1;
+    }

   return tem;
 }


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