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
This commit is contained in:
Jakub Jelinek 2018-03-09 20:12:29 +01:00 committed by Jakub Jelinek
parent 8286793a2b
commit 9d9a9a90ce
4 changed files with 31 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2018-03-09 Jakub Jelinek <jakub@redhat.com>
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 <msebor@redhat.com>
PR tree-optimization/84526

View File

@ -1,3 +1,8 @@
2018-03-09 Jakub Jelinek <jakub@redhat.com>
PR c++/84767
* g++.dg/ext/vla18.C: New test.
2018-03-09 Martin Sebor <msebor@redhat.com>
PR tree-optimization/84526

View File

@ -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;

View File

@ -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