From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16853 invoked by alias); 17 Oct 2009 07:59:16 -0000 Received: (qmail 16842 invoked by uid 22791); 17 Oct 2009 07:59:15 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Oct 2009 07:59:09 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9H7x7mr018012; Sat, 17 Oct 2009 03:59:07 -0400 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9H7x5Bj020011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 Oct 2009 03:59:07 -0400 Received: from livre.localdomain (livre.oliva.athome.lsd.ic.unicamp.br [172.31.160.2]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.3/8.14.3) with ESMTP id n9H7x5xi011696; Sat, 17 Oct 2009 04:59:05 -0300 Received: from livre.localdomain (aoliva@localhost [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5) with ESMTP id n9H7x4nj011306; Sat, 17 Oct 2009 04:59:04 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id n9H7x37U011304; Sat, 17 Oct 2009 04:59:03 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: Re: fix -fcompare-debug regression in asm locators References: Date: Sat, 17 Oct 2009 08:24:00 -0000 In-Reply-To: (Alexandre Oliva's message of "Fri, 16 Oct 2009 04:37:07 -0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg01113.txt.bz2 --=-=-= Content-length: 2036 On Oct 16, 2009, Alexandre Oliva wrote: > While at that, I noticed that the line locator number attached to all > asm_operands and asm_inputs is the locator of the closing brace of the > function body, rather than the locator of the end of the asm statement. > I'm not sure why we have locators in these RTXs, but I'm concerned that > perhaps we expected them to be different for different asm stmts, and > that compilation correctness might depend on it, in which case having > the same locator for all asms in a function may lead to problems. But > even if it's only for error messages, it's still inaccurate and should > probably be fixed, no? I investigated further. The only explicit use for these locators is to issue line directives before the asm code. They're wildly inaccurate for this intended purpose. Ideally, we'd issue the starting line of the string, but this information is lost long before we reach that point: not even the ASM_EXPR from which the GIMPLE_ASM statement is constructed gets it. The parser calls build_asm_expr() with the locus of the asm keyword, and gets back a tree stmt with that locus to pass to build_asm_stmt, which doesn't get any other locus. By that point, the location of the STRING_CST token is already lost. There are two ways I see to retain it: 1. pass it to build_asm_expr() instead of the locus of the ASM keyword, and use that location for the stmt. It will get to the gimple tuple, and end up in the RTX insn. It would render the loci in ASM_OPERANDS and ASM_INPUT obsolete. 2. pass it to build_asm_expr() in addition to the locus of the ASM keyword, and add the location_t to the ASM_EXPR tree. Use it when expanding GIMPLE_ASMs to RTX, so as to fill in the locus field in ASM_OPERANDS and ASM_INPUT. Which way should we go? In the mean time (I'm going to be away for most of next week), here's a patch that uses the locus of the stmt, rather than input_location, to fill in the locus field in ASM_OPERANDS and ASM_INPUT. Is this ok to install? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=gcc-asm-stmt-locus.patch Content-length: 1368 for gcc/ChangeLog from Alexandre Oliva * stmt.c (expand_asm_stmt): Get locus from stmt. Index: gcc/stmt.c =================================================================== --- gcc/stmt.c.orig 2009-10-17 03:52:03.000000000 -0300 +++ gcc/stmt.c 2009-10-17 03:53:13.000000000 -0300 @@ -1099,6 +1099,7 @@ expand_asm_stmt (gimple stmt) size_t i, n; const char *s; tree str, out, in, cl, labels; + location_t locus = gimple_location (stmt); /* Meh... convert the gimple asm operands into real tree lists. Eventually we should make all routines work on the vectors instead @@ -1144,7 +1145,7 @@ expand_asm_stmt (gimple stmt) if (gimple_asm_input_p (stmt)) { - expand_asm_loc (str, gimple_asm_volatile_p (stmt), input_location); + expand_asm_loc (str, gimple_asm_volatile_p (stmt), locus); return; } @@ -1160,7 +1161,7 @@ expand_asm_stmt (gimple stmt) /* Generate the ASM_OPERANDS insn; store into the TREE_VALUEs of OUTPUTS some trees for where the values were actually stored. */ expand_asm_operands (str, outputs, in, cl, labels, - gimple_asm_volatile_p (stmt), input_location); + gimple_asm_volatile_p (stmt), locus); /* Copy all the intermediate outputs into the specified outputs. */ for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++) --=-=-= Content-length: 257 -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist Red Hat Brazil Compiler Engineer --=-=-=--