]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/77919 (ICE converting DC to V2DF mode)
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 07:36:13 +0000 (09:36 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 07:36:13 +0000 (09:36 +0200)
Backported from mainline
2016-10-28  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/77919
* expr.c (expand_expr_real_1) <normal_inner_ref>: Force CONCAT into
MEM if mode1 is not a complex mode.

* g++.dg/torture/pr77919.C: New test.

From-SVN: r248618

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr77919.C [new file with mode: 0644]

index 91ed67aba02cdcfa49150fdee5344514efacca48..2804651add67164de271c170d254648449b9680e 100644 (file)
@@ -1,6 +1,12 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-10-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/77919
+       * expr.c (expand_expr_real_1) <normal_inner_ref>: Force CONCAT into
+       MEM if mode1 is not a complex mode.
+
        2016-10-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/66343
index 0e301f8a7a9ccc7292a1f022024df4f074444ce1..bfb7992290df937d792d297391deec7f7b572190 100644 (file)
@@ -10197,7 +10197,8 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
        if (GET_CODE (op0) == CONCAT && !must_force_mem)
          {
            if (bitpos == 0
-               && bitsize == GET_MODE_BITSIZE (GET_MODE (op0)))
+               && bitsize == GET_MODE_BITSIZE (GET_MODE (op0))
+               && COMPLEX_MODE_P (mode1))
              return op0;
            if (bitpos == 0
                && bitsize == GET_MODE_BITSIZE (GET_MODE (XEXP (op0, 0)))
index 6bf50d262f599d06df0d96b62b1c69592c913339..d060cbb678a5082588a541a3b2cd0842d3e016a5 100644 (file)
@@ -1,6 +1,11 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-10-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/77919
+       * g++.dg/torture/pr77919.C: New test.
+
        2016-10-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/66343
diff --git a/gcc/testsuite/g++.dg/torture/pr77919.C b/gcc/testsuite/g++.dg/torture/pr77919.C
new file mode 100644 (file)
index 0000000..cab6e90
--- /dev/null
@@ -0,0 +1,11 @@
+// PR rtl-optimization/77919
+// { dg-do compile }
+// { dg-additional-options "-Wno-psabi" }
+
+struct A { A (double) {} _Complex double i; };
+typedef int __attribute__ ((vector_size (16))) B;
+typedef struct { B b; } C;
+struct D { D (const B &x) : b (x) {} B b; };
+static inline B foo (const double *x) { C *a; a = (C *) x; return a->b; }
+static inline D baz (const A &x) { return foo ((double *) &x); }
+D b = baz (0);