From d32599a6e99da9345d2b7d94834b7e9dfcc109a8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Fri, 6 Nov 2009 09:46:45 +0100 Subject: 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/testsuite/c-c++-common/builtin-offsetof.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite/c-c++-common/builtin-offsetof.c') diff --git a/gcc/testsuite/c-c++-common/builtin-offsetof.c b/gcc/testsuite/c-c++-common/builtin-offsetof.c index 0ab498a..6d97775 100644 --- a/gcc/testsuite/c-c++-common/builtin-offsetof.c +++ b/gcc/testsuite/c-c++-common/builtin-offsetof.c @@ -21,9 +21,9 @@ f0 () __builtin_offsetof(struct A, p[0]); // { dg-error "non constant address" } __builtin_offsetof(struct B, p[0]); // OK __builtin_offsetof(struct B, p[9]); // OK - __builtin_offsetof(struct B, p[10]); // { dg-warning "greater than size" } + __builtin_offsetof(struct B, p[10]); // OK + __builtin_offsetof(struct B, p[11]); // { dg-warning "greater than size" } __builtin_offsetof(struct B, a.p); // OK __builtin_offsetof(struct B, p[0]); // OK __builtin_offsetof(struct B, a.p[0]); // { dg-error "non constant address" } } - -- cgit v1.1