[gcc r11-9786] Fix target/100106 ICE in gen_movdi
Richard Biener
rguenth@gcc.gnu.org
Thu Apr 7 10:39:58 GMT 2022
https://gcc.gnu.org/g:5155015ce57dc133e006f87fdf0237a5f259bebd
commit r11-9786-g5155015ce57dc133e006f87fdf0237a5f259bebd
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Wed Apr 21 14:13:04 2021 +0200
Fix target/100106 ICE in gen_movdi
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.
(cherry picked from commit c33db31d9ad96f6414460315c12b4b505fad5dd7)
Diff:
---
gcc/simplify-rtx.c | 1 +
gcc/testsuite/gcc.c-torture/compile/pr100106.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index b58ab5e51c7..b9f4f7928d2 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -7230,6 +7230,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
index 00000000000..7f98b4f992e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
@@ -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);
+}
More information about the Gcc-cvs
mailing list