partial fix for c89-array-lvalue.c
Geoff Keating
geoffk@cygnus.com
Sat Aug 12 18:44:00 GMT 2000
This fixes some of the c89-array-lvalue.c failure with enable-checking, and
some of the c99-array-lvalue.c XFAILs. (It then hits another failure
later but I think they're unrelated.)
I'll commit it when it passes bootstrap&test on powerpc-aix.
--
- Geoffrey Keating <geoffk@cygnus.com>
===File ~/patches/cygnus/rs6000-arraylvalue.patch===========
2000-08-12 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.
Index: c-typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-typeck.c,v
retrieving revision 1.82
diff -p -u -u -p -r1.82 c-typeck.c
--- c-typeck.c 2000/08/09 19:52:34 1.82
+++ c-typeck.c 2000/08/13 01:31:38
@@ -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");
}
============================================================
More information about the Gcc-patches
mailing list