]> gcc.gnu.org Git - gcc.git/commitdiff
re PR tree-optimization/69164 (ICE in create_tmp_var, at gimple-expr.c:468)
authorJakub Jelinek <jakub@redhat.com>
Sat, 9 Jan 2016 07:34:41 +0000 (08:34 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 9 Jan 2016 07:34:41 +0000 (08:34 +0100)
PR c++/69164
* class.c (layout_class_type): Use copy_node to copy FIELD_DECLs.

* g++.dg/opt/pr69164.C: New test.

From-SVN: r232187

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr69164.C [new file with mode: 0644]

index 8723cad590c8353a32f076fa67aefa635beb610e..3ec2e1c5bf9db298d8e96e6b51eea46b3d5e4f20 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/69164
+       * class.c (layout_class_type): Use copy_node to copy FIELD_DECLs.
+
 2016-01-08  Jason Merrill  <jason@redhat.com>
 
        PR c++/69158
index 038e4c7c0d520bda14a5c6d8f38d8c09fc9765fc..fc47f9179ca2ee2b355b1798c83e62fab9e51487 100644 (file)
@@ -6484,18 +6484,11 @@ layout_class_type (tree t, tree *virtuals_p)
       for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
        if (TREE_CODE (field) == FIELD_DECL)
          {
-           *next_field = build_decl (input_location,
-                                     FIELD_DECL,
-                                     DECL_NAME (field),
-                                     TREE_TYPE (field));
+           *next_field = copy_node (field);
            DECL_CONTEXT (*next_field) = base_t;
-           DECL_FIELD_OFFSET (*next_field) = DECL_FIELD_OFFSET (field);
-           DECL_FIELD_BIT_OFFSET (*next_field)
-             = DECL_FIELD_BIT_OFFSET (field);
-           DECL_SIZE (*next_field) = DECL_SIZE (field);
-           DECL_MODE (*next_field) = DECL_MODE (field);
            next_field = &DECL_CHAIN (*next_field);
          }
+      *next_field = NULL_TREE;
 
       /* Record the base version of the type.  */
       CLASSTYPE_AS_BASE (t) = base_t;
index 73ecf30bb0f88f1501b7a8f19b8f2c58175433d5..cbcf1bd1b550295f3415b935ce54cde891408aec 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/69164
+       * g++.dg/opt/pr69164.C: New test.
+
 2016-01-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/69167
diff --git a/gcc/testsuite/g++.dg/opt/pr69164.C b/gcc/testsuite/g++.dg/opt/pr69164.C
new file mode 100644 (file)
index 0000000..e9a1a4f
--- /dev/null
@@ -0,0 +1,30 @@
+// PR c++/69164
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2" }
+
+struct A {
+  struct B {
+    B () {}
+    bool : 1;
+  };
+  B foo () { B r; return r; }
+};
+
+struct C {
+  struct D {
+    D (C *x) : d (x->c.foo ()) {}
+    A::B d;
+  };
+  A c;
+};
+
+struct F : C {
+  D f = this;
+  F (int, int) {}
+};
+
+void
+bar (int a, int b)
+{
+  F (b, a);
+}
This page took 1.205139 seconds and 5 git commands to generate.