public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kristerw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108625] New: forwprop introduces new UB Date: Wed, 01 Feb 2023 09:10:37 +0000 [thread overview] Message-ID: <bug-108625-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108625 Bug ID: 108625 Summary: forwprop introduces new UB Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: kristerw at gcc dot gnu.org Target Milestone: --- Consider the function unsigned char foo(int x) { int t = -x; unsigned char t1 = t; unsigned char t2 = t; return t1 + t2; } This does not invoke undefined behavior when called as foo(0x40000001), but forwprop1 optimizes this to unsigned char foo (int x) { int t; unsigned char _5; int _7; <bb 2> : t_2 = -x_1(D); _7 = t_2 - x_1(D); _5 = (unsigned char) _7; return _5; } where _7 has signed overflow for x = 0x40000001.
next reply other threads:[~2023-02-01 9:10 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-01 9:10 kristerw at gcc dot gnu.org [this message] 2023-02-01 21:49 ` [Bug tree-optimization/108625] [11/12/13 Regression] " pinskia at gcc dot gnu.org 2023-02-02 9:58 ` rguenth at gcc dot gnu.org 2023-02-02 12:13 ` cvs-commit at gcc dot gnu.org 2023-02-02 12:14 ` [Bug tree-optimization/108625] [11/12 " rguenth at gcc dot gnu.org 2023-03-15 9:47 ` cvs-commit at gcc dot gnu.org 2023-05-02 12:03 ` [Bug tree-optimization/108625] [11 " cvs-commit at gcc dot gnu.org 2023-05-02 12:06 ` rguenth at gcc dot gnu.org
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-108625-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: linkBe 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).