[Bug fortran/95828] ICE in resolve_select_rank, at fortran/resolve.c:9774

2020-06-27 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95828

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
FIXED on master for gcc-11 and on 10-branch.

Thanks for the report!

[Bug fortran/95828] ICE in resolve_select_rank, at fortran/resolve.c:9774

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

--- Comment #5 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Harald Anlauf
:

https://gcc.gnu.org/g:5e00a2d1aa68f92e413fec01ce912401bcfcf44f

commit r10-8374-g5e00a2d1aa68f92e413fec01ce912401bcfcf44f
Author: Harald Anlauf 
Date:   Thu Jun 25 20:34:48 2020 +0200

PR fortran/95828 - Buffer overflows with SELECT RANK

With SELECT RANK, name mangling results in long internal symbols that
overflows internal buffers.  Fix that.

gcc/fortran/
PR fortran/95828
* match.c (select_rank_set_tmp): Enlarge internal buffer used in
generating a mangled name.
* resolve.c (resolve_select_rank): Likewise.

(cherry picked from commit 77d455ee81ec3a23f8b20259a31ab963716f8e82)

[Bug fortran/95828] ICE in resolve_select_rank, at fortran/resolve.c:9774

2020-06-25 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95828

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

https://gcc.gnu.org/g:77d455ee81ec3a23f8b20259a31ab963716f8e82

commit r11-1667-g77d455ee81ec3a23f8b20259a31ab963716f8e82
Author: Harald Anlauf 
Date:   Thu Jun 25 20:34:48 2020 +0200

PR fortran/95828 - Buffer overflows with SELECT RANK

With SELECT RANK, name mangling results in long internal symbols that
overflows internal buffers.  Fix that.

gcc/fortran/
PR fortran/95828
* match.c (select_rank_set_tmp): Enlarge internal buffer used in
generating a mangled name.
* resolve.c (resolve_select_rank): Likewise.

[Bug fortran/95828] ICE in resolve_select_rank, at fortran/resolve.c:9774

2020-06-24 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95828

--- Comment #3 from anlauf at gcc dot gnu.org ---
Patch posted: https://gcc.gnu.org/pipermail/fortran/2020-June/054604.html

[Bug fortran/95828] ICE in resolve_select_rank, at fortran/resolve.c:9774

2020-06-24 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95828

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 ---
This one is needed to match the resolve.c part:

diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 8063fcad295..b011634792e 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -6496,7 +6496,7 @@ static void
 select_rank_set_tmp (gfc_typespec *ts, int *case_value)
 {
   char name[2 * GFC_MAX_SYMBOL_LEN];
-  char tname[GFC_MAX_SYMBOL_LEN];
+  char tname[GFC_MAX_SYMBOL_LEN + 7];
   gfc_symtree *tmp;
   gfc_symbol *selector = select_type_stack->selector;
   gfc_symbol *sym;

Taking.

[Bug fortran/95828] ICE in resolve_select_rank, at fortran/resolve.c:9774

2020-06-23 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95828

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2020-06-23
 CC||anlauf at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
   Priority|P3  |P4

--- Comment #1 from anlauf at gcc dot gnu.org ---
There's a first buffer overflow, fixed by:

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index c53b312f7ed..cc8676b3e03 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9638,7 +9638,7 @@ resolve_select_rank (gfc_code *code, gfc_namespace
*old_ns)
   gfc_namespace *ns;
   gfc_code *body, *new_st, *tail;
   gfc_case *c;
-  char tname[GFC_MAX_SYMBOL_LEN];
+  char tname[GFC_MAX_SYMBOL_LEN + 7];
   char name[2 * GFC_MAX_SYMBOL_LEN];
   gfc_symtree *st;
   gfc_expr *selector_expr = NULL;

However, there's another one elsewhere that probably needs an instrumented
f951.