From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12547 invoked by alias); 5 May 2011 13:06:18 -0000 Received: (qmail 12532 invoked by uid 22791); 5 May 2011 13:06:17 -0000 X-SWARE-Spam-Status: No, hits=-2.7 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, 05 May 2011 13:06:03 +0000 From: "aoliva at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/48866] gcc hangs when -g is set X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: aoliva at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: aoliva at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status AssignedTo 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: Thu, 05 May 2011 13:06: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-05/txt/msg00450.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48866 Alexandre Oliva changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |aoliva at gcc dot gnu.org |gnu.org | --- Comment #6 from Alexandre Oliva 2011-05-05 12:59:35 UTC --- Created attachment 24189 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24189 Patch that works around the problem It is TER that considers the loads as replaceable and ends up moving the entire computation past the debug stmts. Considering that MEMs are the reason for the inefficiency in cselib, and I don't think replacing loads into addresses of other loads brings us much (any?) benefit, I came up with this hack that fixes the problem. We can't really use the incoming argument for debug info very long: it dies at the first use. So, even though this patch keeps the debug insns at the expected place, and we bind the user variables properly, the binding of y doesn't survive: the value stored in it dies at the first use, on the next insn, and we can't construct an expression based on a chain of MEMs because (as mentioned above) the incoming argument, which held the address of the first MEM, is already dead. With this patch, the expression stored in z is still regarded as replaceable, so the debug insn is bound to a MEM before the load, but after var-tracking, another location expression is emitted with the REG into which the MEM is loaded.