http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47409

Francesco Zappa Nardelli <francesco.zappa.nardelli at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |francesco.zappa.nardelli@gm
                   |                            |ail.com

--- Comment #16 from Francesco Zappa Nardelli <francesco.zappa.nardelli at 
gmail dot com> ---
Dear all

a possibly related issue.  Consider

struct S1 {
  long f;
};
volatile struct S1 g;

struct S1 func_1 () {
  return g;
}

void main () {
  func_1 ();
}

This program, if compiled with a recent gcc svn:

$ gcc -v
Target: x86_64-unknown-linux-gnu
gcc version 4.9.0 20130625 (experimental) (GCC) 

correctly loads the long at g.f at -O0.  However the assembly generated at -O2:

func_1:
      movq    g(%rip), %rax
      ret
main:
      rep; ret 

does not perform the volatile load access, which, as far as I understand, is
incorrect.

-francesco

Reply via email to