public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96536] New: -fcf-protection code in i386.md:restore_stack_nonlocal uses invalid compare-and-jump rtl
@ 2020-08-08 10:36 rsandifo at gcc dot gnu.org
  2020-08-10  8:43 ` [Bug target/96536] " crazylht at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2020-08-08 10:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96536

            Bug ID: 96536
           Summary: -fcf-protection code in i386.md:restore_stack_nonlocal
                    uses invalid compare-and-jump rtl
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rsandifo at gcc dot gnu.org
  Target Milestone: ---
            Target: x86_64

Noticed while working on an optimisation that the
-fcf-protection code in restore_stack_nonlocal uses
a branch based on a clobber result:

(insn 14 13 15 2 (parallel [
            (set (reg:DI 85)
                (minus:DI (reg:DI 85)
                    (mem:DI (plus:DI (reg/f:DI 82)
                            (const_int 16 [0x10])) [2  S8 A8])))
            (clobber (reg:CC 17 flags))
        ]) "gcc/testsuite/gcc.target/i386/cet-sjlj-1.c":16:3 -1
     (nil))
(jump_insn 15 14 40 2 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref 28)
            (pc))) "gcc/testsuite/gcc.target/i386/cet-sjlj-1.c":16:3 -1
     (int_list:REG_BR_PROB 536870916 (nil))
 -> 28)

IMO this is invalid RTL.  A clobber:

  Represents the storing or possible storing of an unpredictable,
  undescribed value …

but this usage requires it to be predictable.  I think we need
to use the parallel-SET *sub<mode>_2 representation instead.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-08-18 17:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08 10:36 [Bug target/96536] New: -fcf-protection code in i386.md:restore_stack_nonlocal uses invalid compare-and-jump rtl rsandifo at gcc dot gnu.org
2020-08-10  8:43 ` [Bug target/96536] " crazylht at gmail dot com
2020-08-10  9:04 ` ubizjak at gmail dot com
2020-08-10  9:32 ` crazylht at gmail dot com
2020-08-13 21:06 ` ubizjak at gmail dot com
2020-08-14  6:33 ` crazylht at gmail dot com
2020-08-17 14:39 ` ubizjak at gmail dot com
2020-08-18  8:54 ` crazylht at gmail dot com
2020-08-18 15:32 ` cvs-commit at gcc dot gnu.org
2020-08-18 15:36 ` cvs-commit at gcc dot gnu.org
2020-08-18 16:49 ` cvs-commit at gcc dot gnu.org
2020-08-18 17:49 ` cvs-commit at gcc dot gnu.org
2020-08-18 17:50 ` ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).