]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR middle-end/85496
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Apr 2018 20:19:39 +0000 (20:19 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Apr 2018 20:19:39 +0000 (20:19 +0000)
* expr.c (store_field): In the bitfield case, if the value comes from
a function call and is returned in registers by means of a PARALLEL,
do not change the mode of the temporary unless BLKmode and VOIDmode.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259574 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 135ac8809338cee4d056e24576f2bcb630508019..833601a038e2965744652543639c80295c540ac8 100644 (file)
@@ -1,9 +1,15 @@
-2018-04-23  Andrey Belevantsev  <abel@ispras.ru>
+2018-04-23  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR middle-end/85496
+       * expr.c (store_field): In the bitfield case, if the value comes from
+       a function call and is returned in registers by means of a PARALLEL,
+       do not change the mode of the temporary unless BLKmode and VOIDmode.
 
-        PR rtl-optimization/85423
+2018-04-23  Andrey Belevantsev  <abel@ispras.ru>
 
-        * sel-sched-ir.c (has_dependence_note_mem_dep): Only discard
-        dependencies to debug insns when the previous insn is non-debug.
+       PR rtl-optimization/85423
+       * sel-sched-ir.c (has_dependence_note_mem_dep): Only discard
+       dependencies to debug insns when the previous insn is non-debug.
 
 2018-04-23  Claudiu Zissulescu  <claziss@synopsys.com>
 
index cf5b63172f1cddcb0c1ea4ba6bd488c2e3b817df..c9e6bf228a41bcf5929030186e9fa11029759882 100644 (file)
@@ -6989,8 +6989,9 @@ store_field (rtx target, poly_int64 bitsize, poly_int64 bitpos,
       if (GET_CODE (temp) == PARALLEL)
        {
          HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
-         scalar_int_mode temp_mode
-           = smallest_int_mode_for_size (size * BITS_PER_UNIT);
+         machine_mode temp_mode = GET_MODE (temp);
+         if (temp_mode == BLKmode || temp_mode == VOIDmode)
+           temp_mode = smallest_int_mode_for_size (size * BITS_PER_UNIT);
          rtx temp_target = gen_reg_rtx (temp_mode);
          emit_group_store (temp_target, temp, TREE_TYPE (exp), size);
          temp = temp_target;
index 0b34bec128fb72d31736d7a963997586de49498e..b1dfe4bdb38b97d58291792ee88338b0a390eebe 100644 (file)
@@ -1,7 +1,11 @@
+2018-04-23  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * g++.dg/torture/pr85496.C: New test.
+
 2018-04-23  Andrey Belevantsev  <abel@ispras.ru>
 
-        PR rtl-optimization/85423
-        * gcc.dg/pr85423.c: New test.
+       PR rtl-optimization/85423
+       * gcc.dg/pr85423.c: New test.
 
 2018-04-20  Martin Sebor  <msebor@redhat.com>
 
diff --git a/gcc/testsuite/g++.dg/torture/pr85496.C b/gcc/testsuite/g++.dg/torture/pr85496.C
new file mode 100644 (file)
index 0000000..3f504a3
--- /dev/null
@@ -0,0 +1,18 @@
+// PR middle-end/85496
+// Reported by Marek Polacek <mpolacek@gcc.gnu.org>
+
+template <typename> class complex;
+template <typename _Tp> complex<_Tp> operator*(complex<_Tp>, complex<_Tp>);
+template <> struct complex<float> { _Complex float _M_value; };
+class A {
+  complex<float> _f0, _f1;
+
+public:
+  complex<float> &m_fn1() { return _f1; }
+};
+complex<float> a;
+void cos() {
+  A b;
+  complex<float> c;
+  b.m_fn1() = c * a;
+}