From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10333 invoked by alias); 9 Jul 2013 08:48:22 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 10279 invoked by uid 48); 9 Jul 2013 08:48:17 -0000 From: "francesco.zappa.nardelli at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/47409] volatile struct member bug Date: Tue, 09 Jul 2013 08:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: francesco.zappa.nardelli at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg00503.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47409 Francesco Zappa Nardelli changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |francesco.zappa.nardelli@gm | |ail.com --- Comment #16 from Francesco Zappa Nardelli --- 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