]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/55032 (Internal compiler error: in strip_typedefs, at cp/tree.c:1199)
authorJason Merrill <jason@redhat.com>
Thu, 6 Dec 2012 20:20:34 +0000 (15:20 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 6 Dec 2012 20:20:34 +0000 (15:20 -0500)
PR c++/55032
* tree.c (build_array_type_1): Re-layout if we found it in the
hash table.

From-SVN: r194265

gcc/ChangeLog
gcc/testsuite/g++.dg/template/array24.C [new file with mode: 0644]
gcc/tree.c

index 7da4e1fc89e5b3f9e332925906c78b2c52f8b180..cecd1efbd70ca217124c29ca29534f432cf2217e 100644 (file)
@@ -1,3 +1,9 @@
+2012-12-06  Jason Merrill  <jason@redhat.com>
+
+       PR c++/55032
+       * tree.c (build_array_type_1): Re-layout if we found it in the
+       hash table.
+
 2012-12-06  Jack Howarth <howarth@bromo.med.uc.edu>
 
        PR 55599/sanitizer
diff --git a/gcc/testsuite/g++.dg/template/array24.C b/gcc/testsuite/g++.dg/template/array24.C
new file mode 100644 (file)
index 0000000..07879d2
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/55032
+
+template<typename T>
+struct vec3t {
+  T c[3];
+};
+
+typedef vec3t<float> vec3;
+
+class Bounds {
+  public:
+    Bounds(const vec3 bb[2]);
+    void foo(const vec3 & v) { v.c[0]; }
+};
+
+template<typename T>
+void work(T& value);
+
+void foo() {
+  vec3 bb[2];
+  work(bb);
+}
index 7cacb2a0d64c072457694eb19abd080c9a4ebe09..429db49e1a8c68b4528722d8e42a00e1ea5f59c4 100644 (file)
@@ -7505,7 +7505,12 @@ build_array_type_1 (tree elt_type, tree index_type, bool shared)
       hashval_t hashcode = iterative_hash_object (TYPE_HASH (elt_type), 0);
       if (index_type)
        hashcode = iterative_hash_object (TYPE_HASH (index_type), hashcode);
+      tree old_t = t;
       t = type_hash_canon (hashcode, t);
+      if (t != old_t)
+       /* Lay it out again in case the element type has been completed since
+          the array was added to the hash table.  */
+       layout_type (t);
     }
 
   if (TYPE_CANONICAL (t) == t)