]> gcc.gnu.org Git - gcc.git/commitdiff
Fix target/100106 ICE in gen_movdi
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 21 Apr 2021 12:13:04 +0000 (14:13 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Tue, 27 Apr 2021 15:47:25 +0000 (17:47 +0200)
As the test case shows, the outer mode may have a higher alignment
requirement than the inner mode here.

2021-04-27  Bernd Edlinger  <bernd.edlinger@hotmail.de>

PR target/100106
* simplify-rtx.c (simplify_context::simplify_subreg): Check the
memory alignment for the outer mode.

* gcc.c-torture/compile/pr100106.c: New testcase.

gcc/simplify-rtx.c
gcc/testsuite/gcc.c-torture/compile/pr100106.c [new file with mode: 0644]

index d13c390a20ccf1dfafcbaf57839554c7ef215f22..ad3b7b2d9d0e3098bb2d2dce3e00c9a00b6164ca 100644 (file)
@@ -7217,6 +7217,7 @@ simplify_context::simplify_subreg (machine_mode outermode, rtx op,
          have instruction to move the whole thing.  */
       && (! MEM_VOLATILE_P (op)
          || ! have_insn_for (SET, innermode))
+      && !(STRICT_ALIGNMENT && MEM_ALIGN (op) < GET_MODE_ALIGNMENT (outermode))
       && known_le (outersize, innersize))
     return adjust_address_nv (op, outermode, byte);
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100106.c b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
new file mode 100644 (file)
index 0000000..7f98b4f
--- /dev/null
@@ -0,0 +1,11 @@
+union a {
+  float _Complex b;
+  long long c;
+};
+
+void g(union a);
+
+void e() {
+  union a f = {1.0f};
+  g(f);
+}
This page took 0.067904 seconds and 5 git commands to generate.