re PR c/71418 (gcc ICE on x86_64-linux-gnu in min_align_of_type, at stor-layout.c...
authorMarek Polacek <polacek@redhat.com>
Wed, 8 Jun 2016 06:39:10 +0000 (06:39 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 8 Jun 2016 06:39:10 +0000 (06:39 +0000)
PR c/71418
* c-decl.c (grokdeclarator): Check TYPE_P.

* gcc.dg/noncompile/pr71418.c: New test.

From-SVN: r237195

gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/noncompile/pr71418.c [new file with mode: 0644]

index de23e36d0ea55ef347253d346183ae65bcd9b3f0..8617f08f97805fc56dceb138691407500f262b81 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-08  Marek Polacek  <polacek@redhat.com>
+
+       PR c/71418
+       * c-decl.c (grokdeclarator): Check TYPE_P.
+
 2016-06-07  David Malcolm  <dmalcolm@redhat.com>
 
        * c-parser.c (c_parser_postfix_expression): In __builtin_offsetof
index d79802ee72c39f9ca866d5393e5750cb394858fd..ac83e2fa5190fe532106464cb395714e19c1d511 100644 (file)
@@ -6313,7 +6313,7 @@ grokdeclarator (const struct c_declarator *declarator,
        }
       else if (TREE_CODE (type) == FUNCTION_TYPE)
        error_at (loc, "alignment specified for function %qE", name);
-      else if (declspecs->align_log != -1)
+      else if (declspecs->align_log != -1 && TYPE_P (type))
        {
          alignas_align = 1U << declspecs->align_log;
          if (alignas_align < min_align_of_type (type))
index 406cc039bf146e3bb003dd931140a22c1cd89502..607f21c3329b735e853f0253f093d944ff0fd5c1 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-08  Marek Polacek  <polacek@redhat.com>
+
+       PR c/71418
+       * gcc.dg/noncompile/pr71418.c: New test.
+
 2016-06-07  Jan Hubicka  <hubicka@ucw.cz>
 
        * gcc.dg/ipa/inlinehint-4.c: Disable partial inlining.
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr71418.c b/gcc/testsuite/gcc.dg/noncompile/pr71418.c
new file mode 100644 (file)
index 0000000..e3243f3
--- /dev/null
@@ -0,0 +1,4 @@
+/* PR c/71418 */
+/* { dg-do compile } */
+
+_Alignas (int) int a[7++]; /* { dg-error "lvalue required" } */