OSDN Git Service

PR middle-end/41935
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Nov 2009 08:46:45 +0000 (08:46 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Nov 2009 08:46:45 +0000 (08:46 +0000)
commite0559d69f5cf440c6b68bb33f4f9982dae4fe395
treeea3cde61de4ddf98d55d21d6887d89e8f61719f0
parente20f082bc41afd9d960373ecaed9691586107f5e
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153962 138bc75d-0d04-0410-961f-82ee72b054a4
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]