From: Jakub Jelinek Date: Sun, 7 Aug 2016 09:49:14 +0000 (+0200) Subject: re PR c/72816 (ICE on x86_64-linux-gnu (tree check: expected tree that contains ... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a9f8a9f7c5a75c266bba5be0c08071d18ed23c6;p=gcc.git re PR c/72816 (ICE on x86_64-linux-gnu (tree check: expected tree that contains ‘decl with RTL’ structure, have ‘field_decl’ in set_decl_rtl, at emit-rtl.c:1282)) PR c/72816 * stor-layout.c (layout_decl): Fix up formatting. (relayout_decl): Allow DECL to be FIELD_DECL. * gcc.dg/pr72816.c: New test. From-SVN: r239218 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b553516ab2..8cd9f2aecfd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-08-07 Jakub Jelinek + + PR c/72816 + * stor-layout.c (layout_decl): Fix up formatting. + (relayout_decl): Allow DECL to be FIELD_DECL. + 2016-08-07 Alan Modra * config/rs6000/rs6000.md (fix_truncsi2): Fix mode of reg. diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 242e79b6d9d..62ab80457b6 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -596,7 +596,7 @@ layout_decl (tree decl, unsigned int known_align) return; gcc_assert (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL - || code == TYPE_DECL ||code == FIELD_DECL); + || code == TYPE_DECL || code == FIELD_DECL); rtl = DECL_RTL_IF_SET (decl); @@ -768,8 +768,8 @@ layout_decl (tree decl, unsigned int known_align) } } -/* Given a VAR_DECL, PARM_DECL or RESULT_DECL, clears the results of - a previous call to layout_decl and calls it again. */ +/* Given a VAR_DECL, PARM_DECL, RESULT_DECL, or FIELD_DECL, clears the + results of a previous call to layout_decl and calls it again. */ void relayout_decl (tree decl) @@ -778,7 +778,8 @@ relayout_decl (tree decl) DECL_MODE (decl) = VOIDmode; if (!DECL_USER_ALIGN (decl)) SET_DECL_ALIGN (decl, 0); - SET_DECL_RTL (decl, 0); + if (DECL_RTL_SET_P (decl)) + SET_DECL_RTL (decl, 0); layout_decl (decl, 0); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06d6bae6b5a..edd4b1cab9f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-07 Jakub Jelinek + + PR c/72816 + * gcc.dg/pr72816.c: New test. + 2016-08-06 Jonathan Wakely * g++.dg/conversion/pr16333.C: Adjust dg-error regexp. diff --git a/gcc/testsuite/gcc.dg/pr72816.c b/gcc/testsuite/gcc.dg/pr72816.c new file mode 100644 index 00000000000..75b8ba182ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr72816.c @@ -0,0 +1,9 @@ +/* PR c/72816 */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu11" } */ + +typedef const int A[]; +struct S { + int a; + A b; /* { dg-error "array size missing" } */ +};