[PATCH] Avoid unnecessary DECL_UID -g/-g0 differences in Fortran FE (PR fortran/63331)

Tobias Burnus burnus@net-b.de
Tue Sep 23 15:20:00 GMT 2014


On 23.09.2014 16:27, Jakub Jelinek wrote:
> This patch changes get_array_descr_info langhook in Fortran FE not to create
> VAR_DECLs, because the langhook is only called with -g and not with -g0
> and thus DECL_UIDs go out of sync too early.
> For VTA, we allow DECL_UID changes, but lhd_set_assembler_name sometimes
> emits DECL_UID into symbol names, so if we can avoid those early, we can
> avoid those for symbols where set assembler name langhook cares.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Looks good to me. Thanks for the report and the patch. Does this solve 
all issues or remains there still a debug-compare issue?

Tobias

> 2014-09-23  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR fortran/63331
> 	* trans-types.c (gfc_get_array_descr_info): Build DEBUG_EXPR_DECL
> 	instead of VAR_DECL for base_decl.
>
> 	* gfortran.dg/pr63331.f90: New test.
>
> --- gcc/fortran/trans-types.c.jj	2014-09-22 10:08:55.000000000 +0200
> +++ gcc/fortran/trans-types.c	2014-09-22 16:40:47.286829928 +0200
> @@ -3041,8 +3041,10 @@ gfc_get_array_descr_info (const_tree typ
>     base_decl = GFC_TYPE_ARRAY_BASE_DECL (type, indirect);
>     if (!base_decl)
>       {
> -      base_decl = build_decl (input_location, VAR_DECL, NULL_TREE,
> -			      indirect ? build_pointer_type (ptype) : ptype);
> +      base_decl = make_node (DEBUG_EXPR_DECL);
> +      DECL_ARTIFICIAL (base_decl) = 1;
> +      TREE_TYPE (base_decl) = indirect ? build_pointer_type (ptype) : ptype;
> +      DECL_MODE (base_decl) = TYPE_MODE (TREE_TYPE (base_decl));
>         GFC_TYPE_ARRAY_BASE_DECL (type, indirect) = base_decl;
>       }
>     info->base_decl = base_decl;
> --- gcc/testsuite/gfortran.dg/pr63331.f90.jj	2014-09-22 17:15:31.959283267 +0200
> +++ gcc/testsuite/gfortran.dg/pr63331.f90	2014-09-22 17:15:23.934324217 +0200
> @@ -0,0 +1,5 @@
> +! PR fortran/63331
> +! { dg-do compile }
> +! { dg-options "-fcoarray=single -fcompare-debug" }
> +
> +include 'intent_out_7.f90'
>
> 	Jakub
>



More information about the Gcc-patches mailing list