From 92a5f2bae5d0528d2eab43a12bef408a0ed781d5 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 8 Jun 2016 06:39:10 +0000 Subject: [PATCH] re PR c/71418 (gcc ICE on x86_64-linux-gnu in min_align_of_type, at stor-layout.c:2402) PR c/71418 * c-decl.c (grokdeclarator): Check TYPE_P. * gcc.dg/noncompile/pr71418.c: New test. From-SVN: r237195 --- gcc/c/ChangeLog | 5 +++++ gcc/c/c-decl.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/noncompile/pr71418.c | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/noncompile/pr71418.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index de23e36d0ea..8617f08f978 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2016-06-08 Marek Polacek + + PR c/71418 + * c-decl.c (grokdeclarator): Check TYPE_P. + 2016-06-07 David Malcolm * c-parser.c (c_parser_postfix_expression): In __builtin_offsetof diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index d79802ee72c..ac83e2fa519 100644 --- a/gcc/c/c-decl.c +++ b/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 a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 406cc039bf1..607f21c3329 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-08 Marek Polacek + + PR c/71418 + * gcc.dg/noncompile/pr71418.c: New test. + 2016-06-07 Jan Hubicka * 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 index 00000000000..e3243f30c38 --- /dev/null +++ b/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" } */ -- 2.30.2