public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Servatius.Brandt@fujitsu-siemens.com To: gcc-gnats@gcc.gnu.org Cc: Joachim.Canisius@fujitsu-siemens.com, Erwin.Unruh@fujitsu-siemens.com, Heinrich.Brand@fujitsu-siemens.com Subject: c/6346: sign extension missing after cast down and up on long long bitfield Date: Thu, 18 Apr 2002 01:56:00 -0000 [thread overview] Message-ID: <20020418084720.29681.qmail@sources.redhat.com> (raw) >Number: 6346 >Category: c >Synopsis: sign extension missing after cast down and up on long long bitfield >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Apr 18 01:56:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Servatius.Brandt@fujitsu-siemens.com >Release: gcc-3.0.4 >Organization: >Environment: sparc-sun-solaris2.8 >Description: After converting the result of the |= operation on an unsigned long long bitfield down to a signed char or short, the conversion up to long long or unsigned long long forgets the sign extension. The problem is the same with and without optimization. >How-To-Repeat: gcc bug15.c && ./a.out Output is 256, 256, 65536, 65536, -1, -1, -1, -1. Correct output would be "-1" eigth times. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="bug15.c"; name="bug15.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bug15.c" c3RydWN0IEMgewogICAgdW5zaWduZWQgbG9uZyBsb25nIGYxIDogODsKICAgIHVuc2lnbmVkIGxv bmcgbG9uZyBjMSA6IDE2Owp9OwoKbWFpbigpCnsKICAgIHN0cnVjdCBDIHY7CiAgICB2LmMxID0g MDsKCiAgICAvKiBBZnRlciBjb252ZXJ0aW5nIHRoZSByZXN1bHQgb2YgdGhlIHw9IG9wZXJhdGlv biBvbiBhbiB1bnNpZ25lZCBsb25nIGxvbmcKICAgICAqIGJpdGZpZWxkIGRvd24gdG8gYSBzaWdu ZWQgY2hhciBvciBzaG9ydCwgdGhlIGNvbnZlcnNpb24gdXAgdG8gbG9uZyBsb25nCiAgICAgKiBv ciB1bnNpZ25lZCBsb25nIGxvbmcgZm9yZ2V0cyB0aGUgc2lnbiBleHRlbnNpb24uICovCiAgICBw cmludGYoIiVsbGRcbiIsICAgICAgICAgIChsb25nIGxvbmcpKHNpZ25lZCBjaGFyKSh2LmMxIHw9 IC0xTEwpKTsKICAgIHByaW50ZigiJWxsZFxuIiwgKHVuc2lnbmVkIGxvbmcgbG9uZykoc2lnbmVk IGNoYXIpKHYuYzEgfD0gLTFMTCkpOwogICAgcHJpbnRmKCIlbGxkXG4iLCAgICAgICAgICAobG9u ZyBsb25nKShzaG9ydCkgICAgICAodi5jMSB8PSAtMUxMKSk7CiAgICBwcmludGYoIiVsbGRcbiIs ICh1bnNpZ25lZCBsb25nIGxvbmcpKHNob3J0KSAgICAgICh2LmMxIHw9IC0xTEwpKTsKCiAgICAv KiBUaGlzIHdvcmtzIGNvcnJlY3RseS4gKi8KICAgIHByaW50ZigiJWxsZFxuIiwgICAgICAgICAg KGxvbmcgbG9uZykoc2lnbmVkIGNoYXIpKC0xTEwpKTsKICAgIHByaW50ZigiJWxsZFxuIiwgKHVu c2lnbmVkIGxvbmcgbG9uZykoc2lnbmVkIGNoYXIpKC0xTEwpKTsKICAgIHByaW50ZigiJWxsZFxu IiwgICAgICAgICAgKGxvbmcgbG9uZykoc2hvcnQpICAgICAgKC0xTEwpKTsKICAgIHByaW50Zigi JWxsZFxuIiwgKHVuc2lnbmVkIGxvbmcgbG9uZykoc2hvcnQpICAgICAgKC0xTEwpKTsKCiAgICAv KiBFeHBlY3RlZCByZXN1bHRzOiAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEuICovCiAg ICAvKiBPdXRwdXQgaXM6IDI1NSwgMjU1LCA2NTUzNSwgNjU1MzUsIC0xLCAtMSwgLTEsIC0xLiAq Lwp9Cg==
next reply other threads:[~2002-04-18 8:56 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-04-18 1:56 Servatius.Brandt [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=20020418084720.29681.qmail@sources.redhat.com \ --to=servatius.brandt@fujitsu-siemens.com \ --cc=Erwin.Unruh@fujitsu-siemens.com \ --cc=Heinrich.Brand@fujitsu-siemens.com \ --cc=Joachim.Canisius@fujitsu-siemens.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).