public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: jbeulich@novell.com To: gcc-gnats@gcc.gnu.org Subject: middle-end/7018: incorrect bitfield handling Date: Thu, 13 Jun 2002 08:26:00 -0000 [thread overview] Message-ID: <20020613151717.20852.qmail@sources.redhat.com> (raw) >Number: 7018 >Category: middle-end >Synopsis: incorrect bitfield handling >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Thu Jun 13 08:26:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Jan Beulich >Release: 3.1 >Organization: >Environment: cross compilers hosted on Cygwin (Win2K) >Description: The handling of bitfields where the type is wider than int, but the actual width is narrower than int is incorrect in that such bitfields are operated on as if they are ints. While certainly one can say that this is an extension anyway, having this inconsistent with the rest of the language doesn't seem to make sense (and the whole point of declaring a narrow bit field with a wide type is obviously to force the compiler to perform calculations with the wider precision), and the correction is simple. >How-To-Repeat: struct s { unsigned long long uf:1; }; unsigned long long utest(const struct s*ps) { return ps->uf << 32; } >Fix: In default_conversion, make the bit-field sub-clause convert the type to [unsigned] int only when the original type isn't wider, and use the wider type in the other cases. >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2002-06-13 15:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20020613151717.20852.qmail@sources.redhat.com \ --to=jbeulich@novell.com \ --cc=gcc-gnats@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).