From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5171 invoked by alias); 7 Jan 2013 12:04:40 -0000 Received: (qmail 5106 invoked by uid 48); 7 Jan 2013 12:04:23 -0000 From: "george.thomas at atmel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/54218] Debug info for function parameters is incorrect when compiled with -O0 Date: Mon, 07 Jan 2013 12:04:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: wrong-debug X-Bugzilla-Severity: normal X-Bugzilla-Who: george.thomas at atmel dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: 2013-01/txt/msg00471.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54218 --- Comment #5 from George Thomas 2013-01-07 12:04:22 UTC --- Created attachment 29095 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29095 Draft Patch for the fix of 54218 The issue is happening because stack space is allocated twice 1. assign_params_setup_stack and 2. expand_used_vars The proposed fix is to allocate the space only once in assign_params_stack by explicitly checking in expand_used_vars if the tree node is of type PARM_DECL. if its PARM_DECL, it would mean that it would already have been expanded and hence do not require further expansion. This fixes the issue and allows debugging to work properly. I would like to know if it would be an acceptable change.