This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/461: non-lvalue arrays
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/461: non-lvalue arrays
- From: Joseph Myers <jsm28 at cam dot ac dot uk>
- Date: Thu, 10 Aug 2000 10:58:28 +0000
- Cc: jsm28 at cam dot ac dot uk
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, Joseph Myers <jsm28@cam.ac.uk>
>Number: 461
>Category: c
>Synopsis: non-lvalue arrays
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 10 04:06:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Joseph S. Myers
>Release: 2.96
>Organization:
none
>Environment:
System: Linux decomino 2.2.16 #1 Thu Jun 8 00:26:22 UTC 2000 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
>Description:
In C90, non-lvalue arrays do not decay to pointers; in C99, they do
(except in those places where arrays do not decay to pointers anyway).
Though GCC allows use of non-lvalue arrays as an extension in some
cases, not all cases are allowed and -pedantic gives warnings without
depending on the standard version.
Undefined behavior does arise if the non-lvalue array is modified at
all, or accessed after the next sequence point, but subject to that
the decay to a pointer is legitimate.
Non-lvalue arrays arise, for example, from structures that are the
values of function calls or assignments.
>How-To-Repeat:
See gcc.dg/c99-array-lval-1.c, currently XFAILing (or would be if it
didn't get tree-check errors - c/351 - instead).
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: