re PR c++/66270 (ICE: canonical types differ for identical types)
authorNathan Sidwell <nathan@acm.org>
Wed, 27 May 2015 20:36:14 +0000 (20:36 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 27 May 2015 20:36:14 +0000 (20:36 +0000)
PR c++/66270
* tree.c (build_pointer_type_for_mode): Canonical type does not
inherit can_alias_all.
(build_reference_type_for_mode): Likewise.

PR c++/66270
* g++.dg/ext/alias-canon3.C: New.

From-SVN: r223773

gcc/cp/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/alias-canon3.C [new file with mode: 0644]
gcc/tree.c

index 92c47388f74a1b97b64e8474f2413691d5acf354..d30eeb775de1adff6930c0665a1d6faa01d8fa76 100644 (file)
@@ -1,3 +1,10 @@
+2015-05-27  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/66270
+       * tree.c (build_pointer_type_for_mode): Canonical type does not
+       inherit can_alias_all.
+       (build_reference_type_for_mode): Likewise.
+
 2015-05-24  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/66243
index 9afe448962196d4287fc1214221930a20a8fee90..1923a2f2fba3fb80f8fdcbedd2d237fafcbd8126 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-27  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/66270
+       * g++.dg/ext/alias-canon3.C: New.
+
 2015-05-27  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/66272
diff --git a/gcc/testsuite/g++.dg/ext/alias-canon3.C b/gcc/testsuite/g++.dg/ext/alias-canon3.C
new file mode 100644 (file)
index 0000000..22e29e8
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// PR c++/66270
+
+typedef float __m256 __attribute__ (( __vector_size__(32), __may_alias__ ));
+struct A {
+  __m256 ymm;
+  const float &f() const;
+};
+
+const float &A::f() const {
+  return ymm[1];
+}
index c22fa765f4c9b4306028f8de804e5e71a8714e6d..ca48c60dd1090b6a2abb1345feb6c46ed231b799 100644 (file)
@@ -7719,6 +7719,7 @@ build_pointer_type_for_mode (tree to_type, machine_mode mode,
                             bool can_alias_all)
 {
   tree t;
+  bool could_alias = can_alias_all;
 
   if (to_type == error_mark_node)
     return error_mark_node;
@@ -7756,7 +7757,7 @@ build_pointer_type_for_mode (tree to_type, machine_mode mode,
 
   if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
     SET_TYPE_STRUCTURAL_EQUALITY (t);
-  else if (TYPE_CANONICAL (to_type) != to_type)
+  else if (TYPE_CANONICAL (to_type) != to_type || could_alias)
     TYPE_CANONICAL (t)
       = build_pointer_type_for_mode (TYPE_CANONICAL (to_type),
                                     mode, false);
@@ -7786,6 +7787,7 @@ build_reference_type_for_mode (tree to_type, machine_mode mode,
                               bool can_alias_all)
 {
   tree t;
+  bool could_alias = can_alias_all;
 
   if (to_type == error_mark_node)
     return error_mark_node;
@@ -7823,7 +7825,7 @@ build_reference_type_for_mode (tree to_type, machine_mode mode,
 
   if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
     SET_TYPE_STRUCTURAL_EQUALITY (t);
-  else if (TYPE_CANONICAL (to_type) != to_type)
+  else if (TYPE_CANONICAL (to_type) != to_type || could_alias)
     TYPE_CANONICAL (t)
       = build_reference_type_for_mode (TYPE_CANONICAL (to_type),
                                       mode, false);