Message ID | 20160810151852.GM14857@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On Wed, 10 Aug 2016, Jakub Jelinek wrote: > 2016-08-10 Jakub Jelinek <jakub@redhat.com> > > PR c/72816 > * c-decl.c (grokdeclarator): When adding TYPE_DOMAIN for flexible > array member through typedef, for orig_qual_indirect == 0 clear > orig_qual_type. > > * gcc.dg/pr72816.c: New test. OK (subject to testing).
--- gcc/c/c-decl.c.jj 2016-08-06 12:11:47.000000000 +0200 +++ gcc/c/c-decl.c 2016-08-10 17:07:10.675144603 +0200 @@ -6710,6 +6710,8 @@ grokdeclarator (const struct c_declarato type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type)); TYPE_DOMAIN (type) = build_range_type (sizetype, size_zero_node, NULL_TREE); + if (orig_qual_indirect == 0) + orig_qual_type = NULL_TREE; } type = c_build_qualified_type (type, type_quals, orig_qual_type, orig_qual_indirect); --- gcc/testsuite/gcc.dg/pr72816.c.jj 2016-08-07 11:48:34.000000000 +0200 +++ gcc/testsuite/gcc.dg/pr72816.c 2016-08-10 17:08:21.153266419 +0200 @@ -5,5 +5,5 @@ typedef const int A[]; struct S { int a; - A b; /* { dg-error "array size missing" } */ + A b; };