Ping: Fix PR fortran/71688

Paul Richard Thomas paul.richard.thomas@gmail.com
Mon Jul 18 13:22:00 GMT 2016


Dear Martin,

This looks like an 'obvious' fix. OK for all the branches, 4.9->trunk.

Thanks for the patch

Paul

On 18 July 2016 at 14:53, Martin Jambor <mjambor@suse.cz> wrote:
> Ping (this time also CCing fortran@gcc.gnu and Honza).
>
> I really think this should be backported to 4.9 in time for the last
> release.
>
> Thanks,
>
> Martin
>
> ----- Original message from Martin Jambor <mjambor@suse.cz> -----
>
> Date: Thu, 30 Jun 2016 11:13:17 +0200
> From: Martin Jambor <mjambor@suse.cz>
> To: GCC Patches <gcc-patches@gcc.gnu.org>
> Subject: Fix PR fortran/71688
>
> Hi,
>
> PR 71688 is about an ICE in cgraphunit.c caused by the fact that
> Fortran FE creates two separate call-graph nodes for a single function
> decl, if you are interested, complete backtraces leading to the point
> of creating them are in bugzilla.
>
> The intuitive fix, changing one of these points so that they call
> cgraph::get_create rather than cgraph_node::create works and given the
> comment just before the line also seems like the correct thing to do:
>
>       /* Register this function with cgraph just far enough to get it
>          added to our parent's nested function list.
>          If there are static coarrays in this function, the nested _caf_init
>          function has already called cgraph_create_node, which also created
>          the cgraph node for this function.  */
>
> It is interesting that the bug lurked so long there.  I have
> bootstrapped and tested the patch below on x86_64-linux, is it OK for
> trunk and (after a while) for all active release branches?
>
> Thanks,
>
> Martin
>
>
> 2016-06-29  Martin Jambor  <mjambor@suse.cz>
>
>         PR fortran/71688
>         * trans-decl.c (gfc_generate_function_code): Use get_create rather
>         than create to get a call graph node.
>
> testsuite/
>         gfortran.dg/pr71688.f90: New test.
>
>
> diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
> index 2f5e434..0e68736 100644
> --- a/gcc/fortran/trans-decl.c
> +++ b/gcc/fortran/trans-decl.c
> @@ -6336,7 +6336,7 @@ gfc_generate_function_code (gfc_namespace * ns)
>          function has already called cgraph_create_node, which also created
>          the cgraph node for this function.  */
>        if (!has_coarray_vars || flag_coarray != GFC_FCOARRAY_LIB)
> -       (void) cgraph_node::create (fndecl);
> +       (void) cgraph_node::get_create (fndecl);
>      }
>    else
>      cgraph_node::finalize_function (fndecl, true);
> diff --git a/gcc/testsuite/gfortran.dg/pr71688.f90 b/gcc/testsuite/gfortran.dg/pr71688.f90
> new file mode 100644
> index 0000000..dbb6d18
> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/pr71688.f90
> @@ -0,0 +1,13 @@
> +! { dg-do compile }
> +! { dg-options "-fcoarray=lib" }
> +
> +program p
> +   call s
> +contains
> +   subroutine s
> +      real :: x[*] = 1
> +      block
> +      end block
> +      x = 2
> +   end
> +end
>
> ----- End original message -----



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein



More information about the Gcc-patches mailing list