Fix PR 17408 and PR 17409.
authorDale Johannesen <dalej@apple.com>
Tue, 14 Sep 2004 00:35:02 +0000 (00:35 +0000)
committerDale Johannesen <dalej@gcc.gnu.org>
Tue, 14 Sep 2004 00:35:02 +0000 (00:35 +0000)
From-SVN: r87468

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr17408.c [new file with mode: 0644]

index 839e78ba9025f4f6942ce18a7b09757486df7db8..905684cd26ee0c8d0a0e2be965159d09def9bdb1 100644 (file)
@@ -1,3 +1,10 @@
+2004-09-13  Dale Johannesen  <dalej@apple.com>
+
+       PR 17408
+       PR 17409
+       * c-decl.c (start_decl): Repair TREE_STATIC for initialized
+       objects declared extern.
+
 2004-09-14  Paul Brook  <paul@codesourcery.com>
 
        * config/arm/arm.c (arm_expand_prologue): Make args_to_push a
index 1d6c40dd0b0e6e275bf03e5a1e12298bd28954c4..efed682dd84e1a5b8d08e15acc9f37f5c097d616 100644 (file)
@@ -3012,8 +3012,11 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
      TEM may equal DECL or it may be a previous decl of the same name.  */
   tem = pushdecl (decl);
 
-  if (initialized)
-    DECL_EXTERNAL (tem) = 0;
+  if (initialized && DECL_EXTERNAL (tem))
+    {
+      DECL_EXTERNAL (tem) = 0;
+      TREE_STATIC (tem) = 1;
+    }
 
   return tem;
 }
index f81a893348c6433ed1f5a3b27267eed1a78c6bd4..b43b48819564425228630c3d8c8db7fd1797ca38 100644 (file)
@@ -1,3 +1,7 @@
+2004-09-13  Dale Johannesen  <dalej@apple.com>
+
+       * gcc.c-torture/compile/pr17408.c:  New test case.
+
 2004-09-13  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/16716
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17408.c b/gcc/testsuite/gcc.c-torture/compile/pr17408.c
new file mode 100644 (file)
index 0000000..4819673
--- /dev/null
@@ -0,0 +1,5 @@
+/* PRs 17408 and 17409, with different options. */
+extern int t;
+extern int t = 0;
+void f(){t =0;}
+void g(){h(&t);}