[Bug target/96536] -fcf-protection code in i386.md:restore_stack_nonlocal uses invalid compare-and-jump rtl
crazylht at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 10 08:43:12 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96536
--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
I'm testing patch like
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index b24a4557871..269c528c3ad 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -19132,15 +19132,15 @@
/* Compare through substraction the saved and the current ssp to decide
if ssp has to be adjusted. */
- tmp = gen_rtx_SET (reg_ssp, gen_rtx_MINUS (word_mode, reg_ssp,
- ssp_slot));
- clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
- tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, clob));
- emit_insn (tmp);
+ emit_insn ((word_mode == SImode)
+ ? gen_subsi3 (reg_ssp, reg_ssp, ssp_slot)
+ : gen_subdi3 (reg_ssp, reg_ssp, ssp_slot));
+ tmp = gen_rtx_COMPARE (CCZmode, reg_ssp, const0_rtx);
+ flags = gen_rtx_REG (CCZmode, FLAGS_REG);
+ emit_insn (gen_rtx_SET (flags, tmp));
/* Compare and jump over adjustment code. */
noadj_label = gen_label_rtx ();
- flags = gen_rtx_REG (CCZmode, FLAGS_REG);
tmp = gen_rtx_EQ (VOIDmode, flags, const0_rtx);
tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
gen_rtx_LABEL_REF (VOIDmode, noadj_label),
@@ -19184,14 +19184,10 @@
emit_insn ((word_mode == SImode)
? gen_incsspsi (reg_255)
: gen_incsspdi (reg_255));
- tmp = gen_rtx_SET (reg_adj, gen_rtx_MINUS (ptr_mode,
- reg_adj,
- GEN_INT (255)));
- clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
- tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, clob));
- emit_insn (tmp);
-
- tmp = gen_rtx_COMPARE (CCmode, reg_adj, GEN_INT (255));
+ emit_insn ((ptr_mode == SImode)
+ ? gen_subsi3 (reg_adj, reg_adj, GEN_INT (255))
+ : gen_subdi3 (reg_adj, reg_adj, GEN_INT (255)));
+ tmp = gen_rtx_COMPARE (CCmode, reg_adj, const0_rtx);
flags = gen_rtx_REG (CCmode, FLAGS_REG);
emit_insn (gen_rtx_SET (flags, tmp));
More information about the Gcc-bugs
mailing list