This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50364] New: Volatile miscompilation


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]