From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22191 invoked by alias); 17 Dec 2010 06:19:47 -0000 Received: (qmail 22177 invoked by uid 22791); 17 Dec 2010 06:19:46 -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; Fri, 17 Dec 2010 06:19:41 +0000 From: "aoliva at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/46724] [4.6 Regression] Wrong debug info: Invalid variable location X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Keywords: wrong-debug X-Bugzilla-Severity: major X-Bugzilla-Who: aoliva at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: aoliva at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.0 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 Date: Fri, 17 Dec 2010 06:19: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: 2010-12/txt/msg02071.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46724 --- Comment #6 from Alexandre Oliva 2010-12-17 06:19:30 UTC --- Created attachment 22792 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22792 Patch I'm testing that fixes the bug Here's what I meant. It does fix the bug at hand, and (surprisingly) we don't end up emitting debug info for the artificial parameter. Tracking it is enough to fix the location info for the variable that maps to the result. It looks like this: .byte 0x8 # uleb128 0x8; (DIE (0x15b) DW_TAG_variable) .ascii "a2\0" # DW_AT_name .byte 0x1 # DW_AT_decl_file (../../gcc/testsuite/gcc.dg/guality/nrv-1.c) .byte 0x10 # DW_AT_decl_line .4byte 0xf5 # DW_AT_type .4byte .LLST1 # DW_AT_location .LLST1: .8byte .LVL0 # Location list begin address (*.LLST1) .8byte .LVL1-1 # Location list end address (*.LLST1) .2byte 0x2 # Location expression size .byte 0x72 # DW_OP_breg2 .byte 0 # sleb128 0 .8byte 0 # Location list terminator begin (*.LLST1) .8byte 0 # Location list terminator end (*.LLST1) The range covers the entire function. I haven't looked into why we don't reduce the single-entry entire-function location list to a simpler location.