Hi,
this patch fixes bug I introduced in 
2014-06-28  Jan Hubicka  <hubi...@ucw.cz>

        * tree-inline.c (remap_type_1): Do not duplicate fields
        that are shared in between type and its main variant.

when adding the conditionals I somehow dropped else path of the test
copying TREE_TYPE of array.

Bootstrapped/regtested x86_64-linux, comitted as obvious.

Honza

        PR tree-optimization/62127
        * g++.dg/torture/pr62127.C: New testcase.
        * tree.c (remap_type_1): When remapping array, remap
        also its type.

Index: testsuite/g++.dg/torture/pr62127.C
===================================================================
--- testsuite/g++.dg/torture/pr62127.C  (revision 0)
+++ testsuite/g++.dg/torture/pr62127.C  (revision 0)
@@ -0,0 +1,11 @@
+// { dg-do compile }
+struct A
+{
+  A(int);
+};
+
+A::A(int i)
+{
+  int x[1][i];
+  x[0][0] = 0;
+}
Index: tree-inline.c
===================================================================
--- tree-inline.c       (revision 216145)
+++ tree-inline.c       (working copy)
@@ -496,6 +496,8 @@ remap_type_1 (tree type, copy_body_data
       if (TYPE_MAIN_VARIANT (new_tree) != new_tree
          && TREE_TYPE (type) == TREE_TYPE (TYPE_MAIN_VARIANT (type)))
        TREE_TYPE (new_tree) = TREE_TYPE (TYPE_MAIN_VARIANT (new_tree));
+      else
+       TREE_TYPE (new_tree) = remap_type (TREE_TYPE (new_tree), id);
 
       if (TYPE_MAIN_VARIANT (new_tree) != new_tree)
        {

Reply via email to