In gcc/:
authorGeoff Keating <geoffk@cygnus.com>
Sun, 13 Aug 2000 21:31:09 +0000 (21:31 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Sun, 13 Aug 2000 21:31:09 +0000 (21:31 +0000)
* c-typeck.c (build_array_ref): Don't complain about non-lvalue
arrays in C99.  Don't try to look at DECL_REGISTER of a
COMPONENT_REF.  Don't complain twice about the same error.

In gcc/testsuite/:
* gcc.dg/c99-array-lval-1.c: The test on line 14 now passes.

From-SVN: r35666

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c99-array-lval-1.c

index 3fc6eb0e4f0dfe8808a4ca4fe925a2da94ee14a2..7ab6a193163e0916c5bc87ec793b0f8a9544b4b0 100644 (file)
@@ -1,5 +1,9 @@
 2000-08-13  Geoff Keating  <geoffk@cygnus.com>
 
+       * c-typeck.c (build_array_ref): Don't complain about non-lvalue
+       arrays in C99.  Don't try to look at DECL_REGISTER of a
+       COMPONENT_REF.  Don't complain twice about the same error.
+
        * fixinc/inclhack.def (aix_pthread): New fix.
        (aix_sysmachine): New fix.
        * fixinc/fixincl.x: Regenerate.
index 66ec40e3034e5149b8012db12c490d54789b1fa5..8459f47633d7017767d261b318529039007ad73f 100644 (file)
@@ -1315,20 +1315,14 @@ build_array_ref (array, index)
            return error_mark_node;
        }
 
-      if (pedantic && !lvalue_p (array))
-       {
-         if (DECL_REGISTER (array))
-           pedwarn ("ISO C forbids subscripting `register' array");
-         else
-           pedwarn ("ISO C89 forbids subscripting non-lvalue array");
-       }
-
       if (pedantic)
        {
          tree foo = array;
          while (TREE_CODE (foo) == COMPONENT_REF)
            foo = TREE_OPERAND (foo, 0);
          if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo))
+           pedwarn ("ISO C forbids subscripting `register' array");
+         else if (! flag_isoc99 && ! lvalue_p (foo))
            pedwarn ("ISO C89 forbids subscripting non-lvalue array");
        }
 
index d2d1d7ffd18b59db84d48aa740321ee76cdc0dc1..907875a5d783b8072255c05d6cb4efe9348d5bb2 100644 (file)
@@ -1,3 +1,7 @@
+2000-08-13  Geoff Keating  <geoffk@cygnus.com>
+
+       * gcc.dg/c99-array-lval-1.c: The test on line 14 now passes.
+
 2000-08-11  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.old-deja/g++.pt/explicit81.C: New test.
index 831fb54ca0e453f2b25b716e21d3b31f412aba47..616ddb97988c25c304a261dccc3a6e865390d510 100644 (file)
@@ -11,7 +11,7 @@ void
 bar (void)
 {
   char *t;
-  (foo ()).c[0]; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
+  (foo ()).c[0]; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */
   t = (foo ()).c; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
   (foo ()).c + 1; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
 }