From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124329 invoked by alias); 29 Jun 2018 18:45:00 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 124310 invoked by uid 89); 29 Jun 2018 18:44:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=H*c:alternative X-HELO: mail-yw0-f178.google.com Received: from mail-yw0-f178.google.com (HELO mail-yw0-f178.google.com) (209.85.161.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Jun 2018 18:44:58 +0000 Received: by mail-yw0-f178.google.com with SMTP id t198-v6so3876442ywc.3; Fri, 29 Jun 2018 11:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=azZX2geriG28+r4EUxxbnv4ECNlWcif+fBOzBKteWKo=; b=BZShdwO96SUM3pHDQHwgpZMTTcqTnLt6mFhRjyebqq2NukzPWSwWalxGsTAjvlGbwa Q5FRtZjbfeLTVJSDMgIlFILLnJiWOkialgWDqpuvnyeW8VBzEWMz7Ewwv0wh+CR8Sbea ZUmsKtojdqZEcI34FJ2CXTlL29lya7nqXmOQbFbQmR2AnGmefpKXxzaXvJU0UpERad5h 2qh7yYPBYh/apVUuGjBlauvjVq2Cc8+UqReiqiqFnNCrFL0Toy+Cm2VCp3f7k7WvQaeQ HGWcGtg10KJGESF+E+3rWzPQN1tU5Xbyb79ZQLp2ms0vNaTbu5yEanzPA8Z3uVUVF6Gm bpLA== MIME-Version: 1.0 Received: by 2002:a0d:e304:0:0:0:0:0 with HTTP; Fri, 29 Jun 2018 11:44:56 -0700 (PDT) In-Reply-To: References: From: Janne Blomqvist Date: Fri, 29 Jun 2018 20:08:00 -0000 Message-ID: Subject: Re: [PATCH] Fix PR86321 To: Richard Biener Cc: GCC Patches , Fortran List , Jakub Jelinek Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00221.txt.bz2 On Thu, Jun 28, 2018 at 12:16 PM, Richard Biener wrote: > > The fortran FE creates array descriptor types via build_distinct_type_copy > which ends up re-using the TYPE_FIELDs chain of FIELD_DECLs between > types in different type-variant chains. While that seems harmless > in practice it breaks once we try to generate C-like debug info for > it because dwarf2out doesn't expect such sharing to occur (and I > wouldn't be surprised of other odd behavior elsewhere that simply > doesn't manifest in a as fatal way as PR86321). > > We generate C-like debug info when you use LTO and -g0 at compile-time > and -g at link-time (that's the way targets w/o debug-copy implementation > end up wired). For non-LTO we avoid directly generating debug for > the array descriptor types by detecting them via a langhook. > > The solution seems to be to adhere to the invariant that TYPE_FIELDs > (and thus FIELD_DECL) sharing is only valid between variant types > and their main variant. Thus, copy the chain. > > Bootstrap / regtest pending on x86_64-unknown-linux-gnu. > > I suppose verify_type () could check proper ownership of the > FIELD_DECLs (simply verify that DECL_CONTEXT is TYPE_MAIN_VARIANT). > But I guess this may break in different ways. Honza - did you > originally try to verify that? It currently says > > for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld)) > { > /* TODO: verify properties of decls. */ > if (TREE_CODE (fld) == FIELD_DECL) > ; > ... > > OK for trunk? > Ok, thanks for the patch, and to Dominique for testing! -- Janne Blomqvist