diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-25 21:19:09 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-25 21:19:09 +0000 |
commit | e807498288ab20ac58d32ac81072b70d09a0e1b1 (patch) | |
tree | 8c910c03d4c980b208b9616acc0764a504105241 /gcc/testsuite/gcc.dg/vla-20.c | |
parent | 2094ad2fdac49c08bb16eceac1cb8edb5c10a294 (diff) | |
download | gcc-e807498288ab20ac58d32ac81072b70d09a0e1b1.tar.gz |
PR c/39582
* c-typeck.c (c_expr_sizeof_type): Create a C_MAYBE_CONST_EXPR
with non-null C_MAYBE_CONST_EXPR_PRE if size of a variable-length
type is an integer constant.
testsuite:
* gcc.dg/vla-20.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146787 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/vla-20.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/vla-20.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vla-20.c b/gcc/testsuite/gcc.dg/vla-20.c new file mode 100644 index 00000000000..04d9ee753a3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vla-20.c @@ -0,0 +1,12 @@ +/* Test use of sizeof with [*] in type name: should not refer to + zero-size array. PR 39582. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +void foo11d(int x[sizeof(int *[*])]); /* { dg-warning "not in a declaration" } */ + +/* Although the size is not constant, it may nevertheless appear in a + constant expression if not evaluated. */ + +void foo11e(int x[1 ? 0 : sizeof(int *[*])]); /* { dg-warning "not in a declaration" } */ +/* { dg-error "zero-size array" "correct zero size" { target *-*-* } 11 } */ |