[Bug fortran/95089] [Coarray] ICE in gfc_get_derived_type, at fortran/trans-types.c:2843

2020-05-26 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95089

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed on master for gcc-11.

Thanks for the report!

[Bug fortran/95089] [Coarray] ICE in gfc_get_derived_type, at fortran/trans-types.c:2843

2020-05-26 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95089

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Harald Anlauf :

https://gcc.gnu.org/g:48d526613961f410a87855ba2fef8909e925d9fa

commit r11-642-g48d526613961f410a87855ba2fef8909e925d9fa
Author: Harald Anlauf 
Date:   Tue May 26 21:19:19 2020 +0200

PR fortran/95089 - ICE in gfc_get_derived_type, at
fortran/trans-types.c:2843

For long module name, derive type and component name, the
generated name-mangled symbol did not fit into a buffer when
coarrays were enabled.  Provide sufficiently large temporary.

2020-05-26  Harald Anlauf  

gcc/fortran/
PR fortran/95089
* trans-types.c (gfc_get_derived_type): Enlarge temporary to hold
mangled name "_caf_symbol".

gcc/testsuite/
PR fortran/95089
* gfortran.dg/pr95089.f90: New test.

[Bug fortran/95089] [Coarray] ICE in gfc_get_derived_type, at fortran/trans-types.c:2843

2020-05-25 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95089

--- Comment #3 from anlauf at gcc dot gnu.org ---
Patch submmitted for review:

https://gcc.gnu.org/pipermail/fortran/2020-May/054385.html

[Bug fortran/95089] [Coarray] ICE in gfc_get_derived_type, at fortran/trans-types.c:2843

2020-05-25 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95089

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |anlauf at gcc dot 
gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
Obvious fix:

diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index b7712dc74d1..99844812505 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2836,9 +2836,10 @@ copy_derived_types:
  && (c->attr.allocatable || c->attr.pointer)
  && !derived->attr.is_class)
{
- char caf_name[GFC_MAX_SYMBOL_LEN];
+ /* Provide sufficient space to hold "_caf_symbol".  */
+ char caf_name[GFC_MAX_SYMBOL_LEN + 6];
  gfc_component *token;
- snprintf (caf_name, GFC_MAX_SYMBOL_LEN, "_caf_%s", c->name);
+ snprintf (caf_name, sizeof (caf_name), "_caf_%s", c->name);
  token = gfc_find_component (derived, caf_name, true, true, NULL);
  gcc_assert (token);
  c->caf_token = token->backend_decl;

[Bug fortran/95089] [Coarray] ICE in gfc_get_derived_type, at fortran/trans-types.c:2843

2020-05-25 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95089

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

   Last reconfirmed||2020-05-25
   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
Summary|ICE in  |[Coarray] ICE in
   |gfc_get_derived_type, at|gfc_get_derived_type, at
   |fortran/trans-types.c:2843  |fortran/trans-types.c:2843
 CC||anlauf at gcc dot gnu.org

--- Comment #1 from anlauf at gcc dot gnu.org ---
All versions from 7 to 11 (master) ICE.

Confirmed.