This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50364] New: Volatile miscompilation
- From: "abramobagnara at tin dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 Sep 2011 09:08:05 +0000
- Subject: [Bug c++/50364] New: Volatile miscompilation
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50364
Bug #: 50364
Summary: Volatile miscompilation
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: abramobagnara@tin.it
$ cat p.cc
volatile int a, b;
void f() {
b = 1 + (a = 0);
}
$ g++ -O2 -S p.cc
$ cat p.s
.file "p.cc"
.text
.p2align 4,,15
.globl _Z1fv
.type _Z1fv, @function
_Z1fv:
.LFB0:
.cfi_startproc
movl $0, a
movl $1, b
ret
.cfi_endproc
...
As the typescript above shows, the conversion between lvalue (a = 0) and
relative rvalue does not generate a volatile read memory access unlike what I
think that standard mandates.