Message ID | 20160607151645.GB3014@redhat.com |
---|---|
State | New |
Headers | show |
On Tue, 7 Jun 2016, Marek Polacek wrote: > 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? OK.
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" } */