]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/51321 (__builtin_types_compatible_p (any_type_t[1][], any_other_type_t) crash...
authorAndrew Pinski <apinski@cavium.com>
Wed, 30 Nov 2011 19:55:36 +0000 (19:55 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 30 Nov 2011 19:55:36 +0000 (11:55 -0800)
2011-11-30  Andrew Pinski  <apinski@cavium.com>

PR c/51321
* c-parser.c (c_parser_postfix_expression): Check groktypename results
before looking at the main variant.

2011-11-30  Andrew Pinski  <apinski@cavium.com>

* gcc.dg/pr51321.c: New testcase.

From-SVN: r181857

gcc/ChangeLog
gcc/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr51321.c [new file with mode: 0644]

index 6acc6af676d1e169b5b1cb755ea243d66e34a2fb..f225378f42c8b6cc72d8421b0212f4c7278c59a0 100644 (file)
@@ -1,3 +1,9 @@
+2011-11-30  Andrew Pinski  <apinski@cavium.com>
+
+       PR c/51321
+       * c-parser.c (c_parser_postfix_expression): Check groktypename results
+       before looking at the main variant.
+
 2011-11-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/48721
index b88b11fc4302b0cafea5285cb19a30daf6e0db08..e227137bfb09f28d0a0406ee18e613eb5186bf3f 100644 (file)
@@ -6568,9 +6568,16 @@ c_parser_postfix_expression (c_parser *parser)
                                     "expected %<)%>");
          {
            tree e1, e2;
+           e1 = groktypename (t1, NULL, NULL);
+           e2 = groktypename (t2, NULL, NULL);
+           if (e1 == error_mark_node || e2 == error_mark_node)
+             {
+               expr.value = error_mark_node;
+               break;
+             }
 
-           e1 = TYPE_MAIN_VARIANT (groktypename (t1, NULL, NULL));
-           e2 = TYPE_MAIN_VARIANT (groktypename (t2, NULL, NULL));
+           e1 = TYPE_MAIN_VARIANT (e1);
+           e2 = TYPE_MAIN_VARIANT (e2);
 
            expr.value
              = comptypes (e1, e2) ? integer_one_node : integer_zero_node;
index a47925bec9d1ec63173966040dd68a9ec6e6897e..67312597c3493d1443e6f7ca248a901995f08c98 100644 (file)
@@ -1,3 +1,7 @@
+2011-11-30  Andrew Pinski  <apinski@cavium.com>
+
+       * gcc.dg/pr51321.c: New testcase.
+
 2011-11-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/48721
diff --git a/gcc/testsuite/gcc.dg/pr51321.c b/gcc/testsuite/gcc.dg/pr51321.c
new file mode 100644 (file)
index 0000000..0e836cf
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+int main ()
+{
+  return (__builtin_types_compatible_p (char[1][], char[1][1])); /* { dg-error "array type has incomplete element type" } */
+}
+
+