re PR c/41935 (ICE : tree check: expected integer_cst, have nop_expr in int_cst_value...
authorJakub Jelinek <jakub@redhat.com>
Fri, 6 Nov 2009 08:46:45 +0000 (09:46 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 6 Nov 2009 08:46:45 +0000 (09:46 +0100)
commitd32599a6e99da9345d2b7d94834b7e9dfcc109a8
treeea3cde61de4ddf98d55d21d6887d89e8f61719f0
parent21a15d9f83dda328d9adfb6deede8d06b8a84c0d
re PR c/41935 (ICE : tree check: expected integer_cst, have nop_expr in int_cst_value, at tree.c:8301)

PR middle-end/41935
* c-common.c (fold_offsetof_1) <case ARRAY_REF>: Don't crash for VLAs
or non-constant index, allow index one past the last element and
allow exceeding array bound in arrays that might be used as flexible
array members.

* gcc.dg/pr41935.c: New test.
* c-c++-common/pr41935.c: New test.
* c-c++-common/builtin-offsetof.c (f0): Allow index one past the last
element.
* gcc.c-torture/execute/pr41935.c: New test.

From-SVN: r153962
gcc/ChangeLog
gcc/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/builtin-offsetof.c
gcc/testsuite/c-c++-common/pr41935.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/pr41935.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr41935.c [new file with mode: 0644]