[Bug fortran/89751] [PDT] ICE: Segmentation fault (in resolve_component)

2019-03-19 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89751

janus at gcc dot gnu.org changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=89707

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #1)
> The test compiles with the following patch
> 
> --- ../_clean/gcc/fortran/resolve.c   2019-03-18 09:41:55.0 +0100
> +++ gcc/fortran/resolve.c 2019-03-18 11:37:56.0 +0100
> @@ -13973,7 +13976,7 @@ resolve_component (gfc_component *c, gfc
>  }
>  
>/* Procedure pointer components: Check PASS arg.  */
> -  if (c->attr.proc_pointer && !c->tb->nopass && c->tb->pass_arg_num == 0
> +  if (c->attr.proc_pointer && c->tb && !c->tb->nopass &&
> c->tb->pass_arg_num == 0
>&& !sym->attr.vtype)
>  {
>gfc_symbol* me_arg;

I don't think this is a particularly good idea. One should rather make sure
that the tb component is present, e.g. via:

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 749faf9fabe..86beb2c6f2f 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -3737,6 +3737,7 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list,
gfc_symbol **sym,

   c2->ts = c1->ts;
   c2->attr = c1->attr;
+  c2->tb = c1->tb;

   /* The order of declaration of the type_specs might not be the
 same as that of the components.  */

However this runs into a different ICE :(


> However I have no idea if the test is valid or not.

I would say it is valid (at least I don't see why it wouldn't be).


This is very much related to PR 89707, almost a duplicate.

[Bug fortran/89751] [PDT] ICE: Segmentation fault (in resolve_component)

2019-03-18 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89751

--- Comment #2 from Arseny Solokha  ---
(In reply to Dominique d'Humieres from comment #1)
> > This testcase was reduced from the same original file as the one filed in 
> > PR89601.
> 
> This has been fixed on trunk at revision r269658.

I see. What I mean is that there's a single file from which both PR89601 and
PR89751 testcases were reduced; they both turned out to unveil independent yet
related issues.

[Bug fortran/89751] [PDT] ICE: Segmentation fault (in resolve_component)

2019-03-18 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89751

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-03-18
 CC||janus at gcc dot gnu.org,
   ||pault at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
The test compiles with the following patch

--- ../_clean/gcc/fortran/resolve.c 2019-03-18 09:41:55.0 +0100
+++ gcc/fortran/resolve.c   2019-03-18 11:37:56.0 +0100
@@ -13973,7 +13976,7 @@ resolve_component (gfc_component *c, gfc
 }

   /* Procedure pointer components: Check PASS arg.  */
-  if (c->attr.proc_pointer && !c->tb->nopass && c->tb->pass_arg_num == 0
+  if (c->attr.proc_pointer && c->tb && !c->tb->nopass && c->tb->pass_arg_num
== 0
   && !sym->attr.vtype)
 {
   gfc_symbol* me_arg;

However I have no idea if the test is valid or not.

> This testcase was reduced from the same original file as the one filed in 
> PR89601.

This has been fixed on trunk at revision r269658.