public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: eriksoe@daimi.au.dk To: gcc-gnats@gcc.gnu.org Subject: middle-end/9998: Lost update on bitfield manipulation via pointer Date: Sat, 08 Mar 2003 06:56:00 -0000 [thread overview] Message-ID: <20030308065457.29409.qmail@sources.redhat.com> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1943 bytes --] >Number: 9998 >Category: middle-end >Synopsis: Lost update on bitfield manipulation via pointer >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Sat Mar 08 06:56:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Erik Søe Sørensen >Release: gcc version 3.1.1 >Organization: >Environment: (Red Hat Linux 7.3 2.96-113) >Description: Under certain circumstances involving two or more write operations on a bitfield, one of the writes may be lost. The reason is that code like this is emitted: movl 8(%ebp), %ecx orb $1, 8(%ebp) ... movl %eax, 8(%ebp) - the first two instructions are in the wrong order. I first noticed this with gcc version 2.96 20000731 - which only generated wrong code with -O2 or higher; in gcc 3.1.1 the problem occurs even without optimizations. >How-To-Repeat: gcc -ggdb bug1.c -O0 The attached program ought to print '1'. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="bug1.i" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bug1.i" IyAxICJidWcxLmMiCiMgMSAiPGJ1aWx0LWluPiIKIyAxICI8Y29tbWFuZCBsaW5lPiIKIyAxICJi dWcxLmMiCmV4dGVybiBpbnQgcHJpbnRmKGNvbnN0IGNoYXIqIGZvcm1hdCwuLi4pOwoKc3RydWN0 IE0gewogICAgICAgIHVuc2lnbmVkIGEgOiAxOwogICAgICAgIHVuc2lnbmVkIGIgOiAyOwp9OwoK c3RydWN0IE4gewogICAgICAgIHVuc2lnbmVkIGEgOiAxOwogICAgICAgIHVuc2lnbmVkIGIgOiAy Owp9OwoKc3RydWN0IE4qIGZvbyhzdHJ1Y3QgTSBtKSB7CiAgICAgICAgc3RydWN0IE0gc2F2ZSA9 IG07CiAgICAgICAgc3RydWN0IE4gKm4gPSAoc3RydWN0IE4qKSAmbTsKICAgICAgICBuLT5hID0g MTsKICAgICAgICBuLT5iID0gc2F2ZS5iXjI7CiAgICAgICAgcmV0dXJuIG47Cn0KCmludCBtYWlu KCkgewogICAgICAgIHN0cnVjdCBNIG07CiAgICAgICAgc3RydWN0IE4qIG47CiAgICAgICAgbS5h ID0gMDsKICAgICAgICBuPWZvbyhtKTsKICAgICAgICBwcmludGYoIiVkXG4iLCBuLT5hKTsKfQo=
next reply other threads:[~2003-03-08 6:56 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-08 6:56 eriksoe [this message] 2003-03-10 15:31 bangerth
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=20030308065457.29409.qmail@sources.redhat.com \ --to=eriksoe@daimi.au.dk \ --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).