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/111280] New: CLZ(0) generated when CLZ_DEFINED_VALUE_AT_ZERO is false Date: Sun, 03 Sep 2023 23:26:59 +0000 [thread overview] Message-ID: <bug-111280-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111280 Bug ID: 111280 Summary: CLZ(0) generated when CLZ_DEFINED_VALUE_AT_ZERO is false Product: gcc Version: 14.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: --- GCC may generate an internal call to CLZ with 0 when CLZ_DEFINED_VALUE_AT_ZERO is false, which can be seen with gcc.c-torture/execute/920501-6.c where sccp changes a loop to _36 = t_10(D) != 0; _35 = .CLZ (t_10(D)); _34 = 63 - _35; _33 = (unsigned int) _34; _32 = (long long unsigned int) _33; _31 = _32 + 1; b_38 = _36 ? _31 : 1; The value _35 is not used when t_10(D) is 0, so it may be reasonable to allow this. But the value _35 may then be any value, so _34 may overflow. I.e., the calculation _34 = 63 - _35; must be changed to be done unsigned. And the ranges calculated during the dom3 pass claims that _35 has a range _35 : [irange] int [0, 63] which also is wrong.
next reply other threads:[~2023-09-03 23:26 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-03 23:26 kristerw at gcc dot gnu.org [this message] 2023-09-04 1:10 ` [Bug tree-optimization/111280] " pinskia at gcc dot gnu.org 2023-09-04 1:11 ` pinskia at gcc dot gnu.org 2023-09-12 11:02 ` rguenth at gcc dot gnu.org 2023-09-12 11:07 ` jakub 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-111280-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).