gcc/Fix-PR94185.patch

67 lines
1.6 KiB
Diff
Raw Normal View History

This backport contains 1 patch from gcc main stream tree.
The commit id of these patchs list as following in the order of time.
0001-Fix-PR94185-Do-not-reuse-insn-alternative-after-chan.patch
bae7b38cf8a21e068ad5c0bab089dedb78af3346
diff -uprN a/gcc/lra-spills.c b/gcc/lra-spills.c
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -427,7 +427,17 @@ remove_pseudos (rtx *loc, rtx_insn *insn)
and avoid LRA cycling in case of subreg memory reload. */
res = remove_pseudos (&SUBREG_REG (*loc), insn);
if (GET_CODE (SUBREG_REG (*loc)) == MEM)
- alter_subreg (loc, false);
+ {
+ alter_subreg (loc, false);
+ if (GET_CODE (*loc) == MEM)
+ {
+ lra_get_insn_recog_data (insn)->used_insn_alternative = -1;
+ if (lra_dump_file != NULL)
+ fprintf (lra_dump_file,
+ "Memory subreg was simplified in in insn #%u\n",
+ INSN_UID (insn));
+ }
+ }
return res;
}
else if (code == REG && (i = REGNO (*loc)) >= FIRST_PSEUDO_REGISTER
diff -uprN a/gcc/testsuite/g++.target/i386/pr94185.C b/gcc/testsuite/g++.target/i386/pr94185.C
new file mode 100644
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr94185.C
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIE -fstack-protector-strong" } */
+
+struct a {
+ int b;
+ int c();
+ a() : b(c()) {}
+ ~a();
+ char *e();
+};
+struct f {
+ void g(int);
+};
+struct ar {
+ int au[256];
+ f h(int);
+} bb;
+a i();
+a j(int);
+long k(int, ar);
+int d;
+void l(char *, ar m, long n) {
+ switch (m.au[d])
+ case 0:
+ n &= 4294967295;
+ bb.h(0).g(n);
+}
+void o() {
+ ar bd;
+ a bh, bi, attrname = j(0) = i();
+ int be = k(0, bd);
+ l(attrname.e(), bd, be);
+}