From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13616 invoked by alias); 28 Jul 2011 18:04:07 -0000 Received: (qmail 13608 invoked by uid 22791); 28 Jul 2011 18:04:06 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Jul 2011 18:03:52 +0000 From: "jan.kratochvil at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/49888] New: VTA: -O2 -g variable value changes, it does not change in the source X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jan.kratochvil at redhat 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-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 28 Jul 2011 18:04:00 -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 X-SW-Source: 2011-07/txt/msg02482.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49888 Summary: VTA: -O2 -g variable value changes, it does not change in the source Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned@gcc.gnu.org ReportedBy: jan.kratochvil@redhat.com CC: aoliva@gcc.gnu.org Target: x86_64-unknown-linux-gnu static int v; static void __attribute__((noinline, noclone)) f (int *p) { int c = *p; v = c; *p = 2; v = 0; /* break-here */ } int main () { int v = 2; f (&v); return 0; } -------------------------------------------------------------------------------- FAIL: gcc (GCC) 4.5.4 20110728 (prerelease) FAIL: gcc (GCC) 4.6.2 20110728 (prerelease) FAIL: gcc (GCC) 4.7.0 20110728 (experimental) -Wall -g -O2 -------------------------------------------------------------------------------- Breakpoint 1, f (p=0x7fffffffda44) at 8.c:7 7 *p = 2; (gdb) disass Dump of assembler code for function f: => 0x0000000000400480 <+0>: movl $0x2,(%rdi) 0x0000000000400486 <+6>: movl $0x0,0x2003e8(%rip) # 0x600878 0x0000000000400490 <+16>: retq End of assembler dump. (gdb) p c $1 = 1 (gdb) stepi 8 v = 0; /* break-here */ (gdb) p c Actual: $2 = 2 Expected: $2 = 1 `c' is never changed in the source code, it should not change in runtime. <63> DW_AT_location : 2 byte block: 75 0 (DW_OP_breg5 (rdi): 0) would be better than a wrong value.