public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/96536] New: -fcf-protection code in i386.md:restore_stack_nonlocal uses invalid compare-and-jump rtl
Date: Sat, 08 Aug 2020 10:36:54 +0000	[thread overview]
Message-ID: <bug-96536-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2020-08-08 10:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-08 10:36 rsandifo at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96536-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).