re PR c/72816 (ICE on x86_64-linux-gnu (tree check: expected tree that contains ...
authorJakub Jelinek <jakub@redhat.com>
Thu, 11 Aug 2016 14:50:09 +0000 (16:50 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 11 Aug 2016 14:50:09 +0000 (16:50 +0200)
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.

From-SVN: r239371

gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr72816.c

index 3161dcb6a02eaa40a76657bc36d5049f28a8421b..94f78438043fb2853bfc3123cb782509df0ee684 100644 (file)
@@ -1,3 +1,10 @@
+2016-08-11  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.
+
 2016-08-08  David Malcolm  <dmalcolm@redhat.com>
 
        PR c/64955
index 5f38985086cb38f16c151ac5d8caa39ad5837a20..9ad473cdbcbd97067b7e6002a4969caeeb16f5f7 100644 (file)
@@ -6710,6 +6710,8 @@ grokdeclarator (const struct c_declarator *declarator,
            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);
index 5dde7f145be70afafc6de3a8d0c2d0002abab605..944c18dffe016a12cb210113c761a0740c56bb12 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/72816
+       * gcc.dg/pr72816.c: New test.
+
 2016-08-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR tree-optimization/71083
index 75b8ba182adbbf4af3dafc0be34e00d35c11560b..b1498c7a7032c0c99a7de609f91dcdc3cab960c2 100644 (file)
@@ -5,5 +5,5 @@
 typedef const int A[];
 struct S {
   int a;
-  A b; /* { dg-error "array size missing" } */
+  A b;
 };