From: Jakub Jelinek Date: Fri, 9 Mar 2018 19:12:29 +0000 (+0100) Subject: re PR c++/84767 (ICE with pointer to VLA) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d9a9a90ce25d3b2748df78e4ae05e0c74d0b671;p=gcc.git re PR c++/84767 (ICE with pointer to VLA) PR c++/84767 * tree-inline.c (copy_tree_body_r): For INDIRECT_REF of a remapped decl, use remap_type if we want to use the type. * g++.dg/ext/vla18.C: New test. From-SVN: r258395 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 346262eec23..7d7ece875a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-09 Jakub Jelinek + + PR c++/84767 + * tree-inline.c (copy_tree_body_r): For INDIRECT_REF of a remapped + decl, use remap_type if we want to use the type. + 2018-03-09 Martin Sebor PR tree-optimization/84526 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ecd0fb83f37..3b3f44f6605 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-09 Jakub Jelinek + + PR c++/84767 + * g++.dg/ext/vla18.C: New test. + 2018-03-09 Martin Sebor PR tree-optimization/84526 diff --git a/gcc/testsuite/g++.dg/ext/vla18.C b/gcc/testsuite/g++.dg/ext/vla18.C new file mode 100644 index 00000000000..31a1bb32f1a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/vla18.C @@ -0,0 +1,19 @@ +// PR c++/84767 +// { dg-do compile } +// { dg-options "" } + +int v[1][10]; + +struct A +{ + A (int); +}; + +A::A (int i) +{ + typedef int T[1][i]; + T *x = (T *) v; + (*x)[0][0] = 0; +} + +A a = 10; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 811829e8529..5a0a2525c0c 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1192,6 +1192,7 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data) *tp = gimple_fold_indirect_ref (ptr); if (! *tp) { + type = remap_type (type, id); if (TREE_CODE (ptr) == ADDR_EXPR) { *tp