From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24433 invoked by alias); 10 Aug 2012 08:37:55 -0000 Received: (qmail 24422 invoked by uid 22791); 10 Aug 2012 08:37:54 -0000 X-SWARE-Spam-Status: No, hits=-3.6 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; Fri, 10 Aug 2012 08:37:33 +0000 From: "senthil_kumar.selvaraj at atmel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/54218] New: Debug info for function parameters is incorrect when compiled with -O0 Date: Fri, 10 Aug 2012 08:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: senthil_kumar.selvaraj at atmel 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 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: 2012-08/txt/msg00561.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54218 Bug #: 54218 Summary: Debug info for function parameters is incorrect when compiled with -O0 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: senthil_kumar.selvaraj@atmel.com Created attachment 27980 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27980 Failing dejagnu test case When compiling a function, like below, with no optimizations (-O0), on a x86_64 target (also occurs for atleast one other target (avr)) void func(int p) { p = 0; p = 32; } wrong debug information is emitted for the function parameter (p), that cause the debugger to keep showing the value of the actual argument, even after p is overwritten. A failing dejagnu test is attached. Based on a preliminary analysis, the actual problem seems to be that stack space for a function parameter (that is not used??) is allocated twice when gimple_expand_cfg runs - once when expand_used_vars runs, and later when assign_parm_setup_stack runs. expand_used_vars allocates stack space despite the check for a default definition being present in the partition, because the function parameter node (which I guess should be the default definition) is not present when iterating over num_ssa_names.