User account creation filtered due to spam.

Bug 5395 - volatile keyword changes volatile write's into write, then read
Summary: volatile keyword changes volatile write's into write, then read
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.0.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-15 14:46 UTC by tim.ousley
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
vol_bug.ii (165 bytes, text/x-c++)
2003-05-21 15:16 UTC, tim.ousley
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tim.ousley 2002-01-15 14:46:01 UTC
'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.

Release:
gcc 3.0.2

Environment:
redhat Linux 7.2

How-To-Repeat:
gcc3 vol_bug.cpp -Os -S
Comment 1 Jakub Jelinek 2002-02-06 05:54:29 UTC
State-Changed-From-To: open->closed
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.