https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127191
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Claudiu Zissulescu <[email protected]>: https://gcc.gnu.org/g:76dad9582058739e3e5f6d4db10c3c2e4de27a32 commit r17-4384-g76dad9582058739e3e5f6d4db10c3c2e4de27a32 Author: Michiel Derhaeg <[email protected]> Date: Thu Sep 17 11:45:25 2026 +0300 arc: Add missing CC clobbers [PR127191] This is a similar issue as PR120375. doloop_end, loop_end, dbnz, flag, and kflag all write the condition codes without declaring it. Since r16-3301-g724d88900b7a moved aarch64-cc-fusion into late-combine, GCC exploits that and keeps condition codes live across these insns, producing wrong code. If a loop fails to resolve to a hardware loop, doloop_end and loop_end fall back to instructions that clobber CC. This needs to be declared on the pattern itself or it will not be taken into account. This fixes gcc.c-torture/execute/pr68185.c for ARC60x and ARC700. dbnz is wrong in the same way as (do)loop_end but I didn't succeed in creating a reproducer for it. flag and kflag write STATUS32, which holds the condition codes. Since the cc-fusion move they can cause unintended clobbers too. PR target/127191 gcc/ChangeLog: * config/arc/arc.md (doloop_end): Clobber CC. (loop_end): Likewise. (dbnz): Likewise. (flag): Likewise. (kflag): Likewise. gcc/testsuite/ChangeLog: * gcc.target/arc/pr127191-1.c: New test. * gcc.target/arc/pr127191-2.c: New test. Signed-off-by: Michiel Derhaeg <[email protected]>
