[Bug target/125217] RISC-V: missing sspopchk when zicfiss + zcmp is enabled

2026-05-09 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125217

Jeffrey A. Law  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED
 Blocks|120763  |

--- Comment #3 from Jeffrey A. Law  ---
Fixed by Michiel's patch on the trunk.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120763
[Bug 120763] [meta-bug] Tracker for bugs to visit during weekly RISC-V meeting

[Bug target/125217] RISC-V: missing sspopchk when zicfiss + zcmp is enabled

2026-05-09 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125217

--- Comment #2 from GCC Commits  ---
The master branch has been updated by Jeff Law :

https://gcc.gnu.org/g:976bba902f3a8146b7ca5b352795977bc9179132

commit r17-425-g976bba902f3a8146b7ca5b352795977bc9179132
Author: Michiel Derhaeg 
Date:   Sat May 9 11:22:07 2026 -0600

[PATCH] RISC-V: Don't emit cm.popret when zcmp + zicfiss is enabled
[PR125217]

Currently when -fcf-protection=return and zcmp are enabled this code is
generated:

sspush ra
cm.push {ra, s0-s1}, -32
..
cm.popret {ra, s0-s1}, 32

riscv_expand_epilogue will skip emitting sspopchk when cm.popret is
emitted. After this patch we will no longer emit cm.popret and instead
use cm.pop + sspopchk + a regular return:

sspush  ra
cm.push {ra, s0-s1}, -32
..
cm.pop {ra, s0-s1}, 32
sspopchk ra
jr ra

Regtested for rv32g & rv64g.

PR target/125217

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_gen_multi_pop_insn): Rename
variable.
(riscv_expand_epilogue): Don't emit cm.popret with shadow stack.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/ssp-zcmp.c: New test.

[Bug target/125217] RISC-V: missing sspopchk when zicfiss + zcmp is enabled

2026-05-08 Thread michiel at derhaeg dot be via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125217

--- Comment #1 from Michiel Derhaeg  ---
https://gcc.gnu.org/pipermail/gcc-patches/2026-May/716166.html