Another error-recovery bug. This time TYPE was error_mark_node but min_align_of_type accessed it via TYPE_ALIGN. So we better check that we're operating on a type.
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2016-06-07 Marek Polacek <pola...@redhat.com> PR c/71418 * c-decl.c (grokdeclarator): Check TYPE_P. * gcc.dg/noncompile/pr71418.c: New test. diff --git gcc/c/c-decl.c gcc/c/c-decl.c index d79802e..ac83e2f 100644 --- gcc/c/c-decl.c +++ gcc/c/c-decl.c @@ -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)) diff --git gcc/testsuite/gcc.dg/noncompile/pr71418.c gcc/testsuite/gcc.dg/noncompile/pr71418.c index e69de29..e3243f3 100644 --- gcc/testsuite/gcc.dg/noncompile/pr71418.c +++ gcc/testsuite/gcc.dg/noncompile/pr71418.c @@ -0,0 +1,4 @@ +/* PR c/71418 */ +/* { dg-do compile } */ + +_Alignas (int) int a[7++]; /* { dg-error "lvalue required" } */ Marek