public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/5395: volatile keyword changes volatile write's into write, then read
@ 2002-01-15 14:46 tim.ousley
  0 siblings, 0 replies; 2+ messages in thread
From: tim.ousley @ 2002-01-15 14:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5395
>Category:       c++
>Synopsis:       volatile keyword changes volatile write's into write, then read
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 15 14:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Tim Ousley
>Release:        gcc 3.0.2
>Organization:
>Environment:
redhat Linux 7.2
>Description:
'volatile' keyword changes a variable write into a write followed by a read.  This makes it quite difficult to access hardware registers, which can confuse the hardware when read.  For instance, an access to a volatile address produces:

movw	$100, 10000
movw	10000, %ax

This only happens when using g++.  If I change the filename from vol_bug.cpp to vol_bug.c, the code does not write, then read from a volatile location.
>How-To-Repeat:
gcc3 vol_bug.cpp -Os -S
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="vol_bug.ii"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="vol_bug.ii"

IyA1ICJ2b2xfYnVnLmNwcCIKaW5saW5lIHZvaWQgd3JpdGUxNiggdW5zaWduZWQgaW50IGFkZHJl
c3MsIGNvbnN0IGludCBkYXRhKQp7CiAgIGNoYXIqIGFkZHIgPSAoY2hhciAqKWFkZHJlc3M7CiAg
ICoodm9sYXRpbGUgdW5zaWduZWQgc2hvcnQgKikgKChjaGFyICopKGFkZHIpKSA9IGRhdGE7Cn0K
CmludCBtYWluKCl7CiAgIHdyaXRlMTYoMTAwMDAsMTAwKTsKICAgd3JpdGUxNigxMDAwMCwyMDAp
OwoKICAgcmV0dXJuIDA7Cn0K


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/5395: volatile keyword changes volatile write's into write, then read
@ 2002-02-06  5:54 jakub
  0 siblings, 0 replies; 2+ messages in thread
From: jakub @ 2002-02-06  5:54 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, tim.ousley

Synopsis: volatile keyword changes volatile write's into write, then read

State-Changed-From-To: open->closed
State-Changed-By: jakub
State-Changed-When: Wed Feb  6 05:54:29 2002
State-Changed-Why:
    This was fixed by http://gcc.gnu.org/ml/gcc-patches/2002-01/msg00041.html
    and follow up patches in gcc 3.1.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5395


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-06 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-15 14:46 c++/5395: volatile keyword changes volatile write's into write, then read tim.ousley
2002-02-06  5:54 jakub

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).