c-decl.c (grokdeclarator): Do not complain about redeclaring visible "static" identif...
authorMark Mitchell <mark@codesourcery.com>
Thu, 18 Mar 2004 18:58:08 +0000 (18:58 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 18 Mar 2004 18:58:08 +0000 (18:58 +0000)
* c-decl.c (grokdeclarator): Do not complain about redeclaring
visible "static" identifiers "extern" in a local scope.

* dwarf2out.c (loc_descriptor_from_tree): Handle pre- and
post-increments/decrements.

* gcc.dg/local1.c: New test.

* gcc.dg/debug/dwarf2/c99-typedef1.c: New test.

From-SVN: r79634

gcc/ChangeLog
gcc/c-decl.c
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/local1.c [new file with mode: 0644]

index d55df0a..fe19b78 100644 (file)
@@ -1,3 +1,10 @@
+2004-03-18  Mark Mitchell  <mark@codesourcery.com>
+
+       * c-decl.c (grokdeclarator): Do not complain about redeclaring
+       visible "static" identifiers "extern" in a local scope.
+       * dwarf2out.c (loc_descriptor_from_tree): Handle pre- and
+       post-increments/decrements.
+
 2004-03-18  Bob Wilson  <bob.wilson@acm.org>
 
        * config/xtensa/xtensa.c (current_function_arg_words): Delete.
index e59789b..9589d54 100644 (file)
@@ -4416,7 +4416,7 @@ grokdeclarator (tree declarator, tree declspecs,
 
        /* It is invalid to create an `extern' declaration for a
           variable if there is a global declaration that is
-          `static'.  */
+          `static' and the global declaration is not visible.  */
        if (extern_ref && current_scope != global_scope)
          {
            tree global_decl;
@@ -4424,6 +4424,7 @@ grokdeclarator (tree declarator, tree declspecs,
            global_decl = identifier_global_value (declarator);
            if (global_decl
                && TREE_CODE (global_decl) == VAR_DECL
+               && lookup_name (declarator) != global_decl
                && !TREE_PUBLIC (global_decl))
              error ("variable previously declared `static' redeclared "
                     "`extern'");
index cb28ffc..88a06e2 100644 (file)
@@ -8716,6 +8716,13 @@ loc_descriptor_from_tree (tree loc, int addressp)
     case CALL_EXPR:
       return 0;
 
+    case PREINCREMENT_EXPR:
+    case PREDECREMENT_EXPR:
+    case POSTINCREMENT_EXPR:
+    case POSTDECREMENT_EXPR:
+      /* There are no opcodes for these operations.  */
+      return 0;
+
     case ADDR_EXPR:
       /* We can support this only if we can look through conversions and
         find an INDIRECT_EXPR.  */
index b2f0ee1..b7ff475 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-18  Mark Mitchell  <mark@codesourcery.com>
+
+       * gcc.dg/local1.c: New test.
+
+       * gcc.dg/debug/dwarf2/c99-typedef1.c: New test.
+
 2004-03-17  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.dg/torture/builtin-convert-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c
new file mode 100644 (file)
index 0000000..b7bd66a
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-options "-std=iso9899:1999 -gdwarf-2" }
+
+void f() {
+  int n = 3;
+  typedef int T[n++];
+  
+  T t;
+  t[0] = 7;
+}
diff --git a/gcc/testsuite/gcc.dg/local1.c b/gcc/testsuite/gcc.dg/local1.c
new file mode 100644 (file)
index 0000000..700070a
--- /dev/null
@@ -0,0 +1,7 @@
+static int i;
+
+extern int i;
+
+static void f() {
+  extern int i;
+}