From: Jakub Jelinek Date: Sat, 20 Oct 2018 08:58:00 +0000 (+0200) Subject: re PR middle-end/87647 (ICE on valid code in decode_addr_const, at varasm.c:2958) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ca66a6cd6101b234a0506715f517cc16e570b123;p=gcc.git re PR middle-end/87647 (ICE on valid code in decode_addr_const, at varasm.c:2958) PR middle-end/87647 * varasm.c (decode_addr_const): Handle COMPOUND_LITERAL_EXPR. * gcc.c-torture/compile/pr87647.c: New test. From-SVN: r265341 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 622765db052..f59167cca89 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-10-20 Jakub Jelinek + + PR middle-end/87647 + * varasm.c (decode_addr_const): Handle COMPOUND_LITERAL_EXPR. + 2018-10-20 Andreas Schwab * doc/ux.texi: Move @section directly after @node. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3000e214a16..86fa75673ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-10-20 Jakub Jelinek + + PR middle-end/87647 + * gcc.c-torture/compile/pr87647.c: New test. + 2018-10-19 Jakub Jelinek PR middle-end/85488 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr87647.c b/gcc/testsuite/gcc.c-torture/compile/pr87647.c new file mode 100644 index 00000000000..67f9d873413 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr87647.c @@ -0,0 +1,15 @@ +/* PR middle-end/87647 */ + +struct A {}; +struct A *const b = &(struct A) {}; +struct B { char *s; struct A *t; }; +void bar (struct B *); + +void +foo (void) +{ + struct B a[] = { "", b, "", b, "", b, "", b, "", b, "", b, "", b, "", b, + "", b, "", b, "", b, "", b, "", b, "", b, "", b, "", b, + "", b }; + bar (a); +} diff --git a/gcc/varasm.c b/gcc/varasm.c index 78cb000ca04..91650eea9f7 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2953,6 +2953,11 @@ decode_addr_const (tree exp, struct addr_const *value) gen_rtx_SYMBOL_REF (Pmode, "origin of addresses")); break; + case COMPOUND_LITERAL_EXPR: + gcc_assert (COMPOUND_LITERAL_EXPR_DECL (target)); + x = DECL_RTL (COMPOUND_LITERAL_EXPR_DECL (target)); + break; + default: gcc_unreachable (); }