public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: ms@siroyan.com To: gcc-gnats@gcc.gnu.org Subject: c/6515: incorrect bitfield promotion Date: Tue, 30 Apr 2002 02:16:00 -0000 [thread overview] Message-ID: <20020430090954.24040.qmail@sources.redhat.com> (raw) >Number: 6515 >Category: c >Synopsis: incorrect bitfield promotion >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Apr 30 02:16:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: ms@siroyan.com >Release: 3.0.4 >Organization: >Environment: i686-pc-linux-gnu >Description: In the attached example test1() and test2() both perform a % operation. I expected an unsigned mod operation performed in both cases, in practice it only occurs in the second case, in the former case the (unsigned int)cast appears to have no effect. I expected: * x.b cast to (unsigned int) * x.a promoted to int by integral promotion * x.a converted to (unsigned int), by arithmetic conversion to bring x.a x.b to a common type. * unsigned mod applied to x.a and x.b >How-To-Repeat: gcc -O2 x.c ./a.out >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="x.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="x.c" c3RydWN0IHsKICBpbnQgYTo3OwogIHVuc2lnbmVkIGludCBiOjY7Cn0geDsKCnVuc2lnbmVkIGlu dCBhYSwgYmI7Cgppbml0ICgpCnsKICBhYSA9IHguYSA9IC0xMzsKICBiYiA9IHguYiA9IDYxOwp9 CgptYWluICgpCnsKICBpbml0ICgpOwogIHRlc3QxICgpOwogIHRlc3QyICgpOwp9Cgp0ZXN0MSAo KQp7CiAgcHJpbnRmICgiJWQgJSUgJWQgPSAlZFxuIiwgeC5hLCB4LmIsIHguYSAlICgodW5zaWdu ZWQgaW50KSB4LmIpKTsKfQoKdGVzdDIgKCkKewogIHByaW50ZiAoIiVkICUlICVkID0gJWRcbiIs IGFhLCBiYiwgYWEgJSBiYik7Cn0K
next reply other threads:[~2002-04-30 9:16 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-04-30 2:16 ms [this message] 2002-05-22 5:09 neil
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=20020430090954.24040.qmail@sources.redhat.com \ --to=ms@siroyan.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).