public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/102245] [12 Regression] false int-in-bool-context warning with shift Date: Fri, 17 Sep 2021 14:58:40 +0000 [thread overview] Message-ID: <bug-102245-4-T21HO2r636@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102245-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102245 --- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>: https://gcc.gnu.org/g:2578a3870ef849dc77e98796600181b64ae4fd61 commit r12-3623-g2578a3870ef849dc77e98796600181b64ae4fd61 Author: Roger Sayle <roger@nextmovesoftware.com> Date: Fri Sep 17 15:57:34 2021 +0100 PR c/102245: Disable sign-changing optimization for shifts by zero. Respecting Jakub's suggestion that it may be better to warn-on-valid for "if (x << 0)" as the author might have intended "if (x < 0)" [which will also warn when x is _Bool], the simplest way to resolve this regression is to disable the recently added fold transformation for shifts by zero; these will be optimized later (elsewhere). Guarding against integer_zerop is the simplest of three alternatives; the second being to only apply this transformation to GIMPLE and not GENERIC, and the third (potentially) being to explicitly handle shifts by zero here, with an (if cond then else), optimizing the expression to a convert, but awkwardly duplicating a more general transformation earlier in match.pd's shift simplifications. 2021-09-17 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR c/102245 * match.pd (shift optimizations): Disable recent sign-changing optimization for shifts by zero, these will be folded later. gcc/testsuite/ChangeLog PR c/102245 * gcc.dg/Wint-in-bool-context-4.c: New test case.
next prev parent reply other threads:[~2021-09-17 14:58 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-08 21:36 [Bug c/102245] New: " pinskia at gcc dot gnu.org 2021-09-08 21:48 ` [Bug c/102245] " pinskia at gcc dot gnu.org 2021-09-08 21:52 ` pinskia at gcc dot gnu.org 2021-09-08 21:55 ` [Bug c/102245] [12 Regression] " pinskia at gcc dot gnu.org 2021-09-08 22:14 ` jakub at gcc dot gnu.org 2021-09-08 22:38 ` jakub at gcc dot gnu.org 2021-09-09 7:37 ` rguenth at gcc dot gnu.org 2021-09-09 9:57 ` pinskia at gcc dot gnu.org 2021-09-13 10:45 ` roger at nextmovesoftware dot com 2021-09-14 7:56 ` roger at nextmovesoftware dot com 2021-09-17 14:58 ` cvs-commit at gcc dot gnu.org [this message] 2021-09-18 9:11 ` roger at nextmovesoftware 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-102245-4-T21HO2r636@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).