From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105136 invoked by alias); 29 May 2015 19:27:07 -0000 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 Received: (qmail 105117 invoked by uid 89); 29 May 2015 19:27:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f52.google.com Received: from mail-wg0-f52.google.com (HELO mail-wg0-f52.google.com) (74.125.82.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 29 May 2015 19:27:05 +0000 Received: by wgv5 with SMTP id 5so70722931wgv.1 for ; Fri, 29 May 2015 12:27:02 -0700 (PDT) X-Received: by 10.180.100.101 with SMTP id ex5mr9644499wib.13.1432927622469; Fri, 29 May 2015 12:27:02 -0700 (PDT) Received: from android-4c5a376a18c0e957.fritz.box (p4FE9C15D.dip0.t-ipconnect.de. [79.233.193.93]) by mx.google.com with ESMTPSA id i6sm9651935wjf.29.2015.05.29.12.27.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2015 12:27:01 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: <5568B32A.1010100@redhat.com> References: <554C060F.6000609@redhat.com> <555CAD35.5040304@redhat.com> <5565BB13.6040205@redhat.com> <5567643C.1020306@redhat.com> <55677C05.6040302@redhat.com> <5568B32A.1010100@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [patch 10/10] debug-early merge: compiler proper From: Richard Biener Date: Fri, 29 May 2015 19:40:00 -0000 To: Aldy Hernandez ,Jason Merrill ,Jan Hubicka CC: gcc-patches Message-ID: <78B564EA-B9C4-4351-BFD0-9C78EA4C2528@gmail.com> X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg02819.txt.bz2 On May 29, 2015 8:42:50 PM GMT+02:00, Aldy Hernandez wrote: >On 05/28/2015 04:35 PM, Jason Merrill wrote: >> On 05/28/2015 02:53 PM, Aldy Hernandez wrote: >>> On 05/27/2015 08:39 AM, Jason Merrill wrote: >>>> On 05/20/2015 11:50 AM, Aldy Hernandez wrote: >>> >>>>> + /* Fill in the size of variable-length fields in late dwarf. >*/ >>>>> + if (TREE_ASM_WRITTEN (type) >>>>> + && !early_dwarf_dumping) >>>>> + { >>>>> + tree member; >>>>> + for (member = TYPE_FIELDS (type); member; member = >DECL_CHAIN >>>>> (member)) >>>>> + fill_variable_array_bounds (TREE_TYPE (member)); >>>>> + return; >>>>> + } >>>> >>>> Why is this happening in late dwarf? I'm concerned that front-end >>>> information that is necessary to do this might be lost by that >point. >>> >>> I thought only after the optimizations had run their course would we >be >>> guaranteed to have accurate bound information. At least, that's >what my >>> experience showed. >> >> Hmm, I'm don't know why optimizations would change the representation >of >> the array type. >> >>>>> + /* Variable-length types may be incomplete even if >>>>> + TREE_ASM_WRITTEN. For such types, fall through to >>>>> + gen_array_type_die() and possibly fill in >>>>> + DW_AT_{upper,lower}_bound attributes. */ >>>>> + if ((TREE_CODE (type) != ARRAY_TYPE >>>>> + && TREE_CODE (type) != RECORD_TYPE >>>>> + && TREE_CODE (type) != UNION_TYPE >>>>> + && TREE_CODE (type) != QUAL_UNION_TYPE) >>>>> + || (TYPE_SIZE (type) >>>>> + && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)) >>>> >>>> Similarly, why check for INTEGER_CST here? >>> >>> The INTEGER_CST check was supposed to mean "we have bound >information >>> already, no need to look further". >>> >>> I guess we could have a variable length bound that does not decay to >a >>> constant. >> >> Right. I would expect that to usually be the case with VLAs. >> >>> Perhaps I could check the presence of a cached DIE with a >>> type DIE containing a DW_TAG_subrange_type *and* >>> DW_AT_{lower,upper}_bound ??. Basically I just want to add bound >>> information, if available and not already present. >>> >>> Suggestions? >> >> I'm still not sure why we can't just emit bound info in early dwarf. >Can >> you be more specific about the optimization thing? > >Ok, I see what I was trying to do, albeit incorrectly. Imagine this: > >unsigned int i=555; > >int main() >{ > unsigned int array[i]; > ... >} > >For the VLA, I'd like to check if we have an array type with a missing >DW_AT_{upper,lower}_bound late in the game, and fill it in. > >During early dwarf we only have an uninitialized gimple register >representing the bound, and loc_list_from_tree() cannot find the RTL >with the final bound location. Thus, we end up with a missing bound, >which I propose to fill in late dwarf. > >Obviously I was doing some nonsense with TYPE_SIZE != INTEGER_CST, when > >in reality I should probably check that TREE_CODE (type) == ARRAY_TYPE >and that we are missing the bound late (by looking for DW_AT_*_bound in > >the cached DIE). > >Is this acceptable, or where you thinking of some other scheme? ISTR I had to mark the gimple reg used for the bound as non-DECL_IGNORED for the LTO stuff. Richard. >Thanks. >Aldy