This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR86321
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Fortran List <fortran at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 29 Jun 2018 21:44:56 +0300
- Subject: Re: [PATCH] Fix PR86321
- References: <alpine.LSU.2.20.1806281108340.5043@zhemvz.fhfr.qr>
On Thu, Jun 28, 2018 at 12:16 PM, Richard Biener <rguenther@suse.de> 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