public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bugdal at aerifal dot cx" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/94631] Wrong codegen for arithmetic on bitfields Date: Fri, 17 Apr 2020 20:54:47 +0000 [thread overview] Message-ID: <bug-94631-4-qi7OHJP3dT@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94631-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94631 --- Comment #8 from Rich Felker <bugdal at aerifal dot cx> --- OK, I think it's in 6.3.1.1 Boolean, characters, and integers, ¶2, but somewhat poorly worded: "The following may be used in an expression wherever an int or unsigned int may be used: - An object or expression with an integer type (other than int or unsigned int) whose integer conversion rank is less than or equal to the rank of int and unsigned int. - A bit-field of type _Bool, int, signed int, or unsigned int. If an int can represent all values of the original type (as restricted by the width, for a bit-field), the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions." The first sentence with second bullet point suggests it should behave as unsigned int, but the "as restricted by the width, for a bit-field" in the paragraph after after the bulleted list seems to confirm your interpretation.
next prev parent reply other threads:[~2020-04-17 20:54 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-17 4:53 [Bug c/94631] New: " bugdal at aerifal dot cx 2020-04-17 5:09 ` [Bug c/94631] " pinskia at gcc dot gnu.org 2020-04-17 5:17 ` bugdal at aerifal dot cx 2020-04-17 5:34 ` pinskia at gcc dot gnu.org 2020-04-17 8:09 ` rguenth at gcc dot gnu.org 2020-04-17 15:55 ` bugdal at aerifal dot cx 2020-04-17 20:43 ` joseph at codesourcery dot com 2020-04-17 20:50 ` bugdal at aerifal dot cx 2020-04-17 20:54 ` bugdal at aerifal dot cx [this message] 2022-10-26 0:05 ` pinskia 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-94631-4-qi7OHJP3dT@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).