public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "arnd at linaro dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/104711] New: Unnecessary -Wshift-negative-value warning Date: Sun, 27 Feb 2022 21:27:37 +0000 [thread overview] Message-ID: <bug-104711-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104711 Bug ID: 104711 Summary: Unnecessary -Wshift-negative-value warning Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: arnd at linaro dot org Target Milestone: --- During the discussion of increasing the C standard version of the Linux kernel fro m gnu89 to gnu99 or higher, it turned out that gcc warns about code that shifts negative signed integers [2]. This is undefined behavior in standard C99, but defined as a GNU extension in GCC.[3]. This warning is enabled by default at the -Wextra level for C99/GNU99 or higher, but disabled for C89/GNU89. In clang, the warning is enabled by default at the -Wall level but in turn disabled when building with -fwrapv or -fno-strict-overflow (as the Linux kernel does). It would be nice if future compiler releases could either demote the warning from being enabled at -Wextra to -Wpedantic, or follow clang and disable it when used with -fwrapv/-fno-strict-overflow. [1] https://lore.kernel.org/lkml/20220227010956.GW614@gate.crashing.org/ [2] https://www.godbolt.org/z/s1TzxrGz4 [3] https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Integers-implementation.html
next reply other threads:[~2022-02-27 21:27 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-27 21:27 arnd at linaro dot org [this message] 2022-02-27 21:40 ` [Bug c/104711] " pinskia at gcc dot gnu.org 2022-02-27 22:37 ` segher at gcc dot gnu.org 2022-02-27 22:38 ` segher at gcc dot gnu.org 2022-02-27 22:42 ` segher at gcc dot gnu.org 2022-03-01 7:58 ` rguenth at gcc dot gnu.org 2022-03-01 9:07 ` jakub at gcc dot gnu.org 2022-03-01 14:11 ` jakub at gcc dot gnu.org 2022-03-01 17:51 ` segher at gcc dot gnu.org 2022-03-09 8:16 ` cvs-commit at gcc dot gnu.org 2022-03-29 5:53 ` cvs-commit at gcc dot gnu.org 2022-05-10 8:25 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:25 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:36 ` 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-104711-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).