public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102717] New: ICE in gfc_simplify_reshape, at fortran/simplify.c:6843
@ 2021-10-12 17:33 gscfq@t-online.de
2021-10-12 21:33 ` [Bug fortran/102717] " anlauf at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2021-10-12 17:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102717
Bug ID: 102717
Summary: ICE in gfc_simplify_reshape, at
fortran/simplify.c:6843
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gscfq@t-online.de
Target Milestone: ---
Affects versions down to at least r5 :
$ cat z1.f90
program p
integer, parameter :: a(1) = 2
integer, parameter :: b(2,2) = reshape([1,2,3,4], -[a,a])
end
$ gfortran-12-20211010 -c z1.f90
f951: internal compiler error: in gfc_simplify_reshape, at
fortran/simplify.c:6843
0x82b845 gfc_simplify_reshape(gfc_expr*, gfc_expr*, gfc_expr*, gfc_expr*)
../../gcc/fortran/simplify.c:6843
0x7aa71b do_simplify
../../gcc/fortran/intrinsic.c:4678
0x7b50ba gfc_intrinsic_func_interface(gfc_expr*, int)
../../gcc/fortran/intrinsic.c:5050
0x8078e9 resolve_unknown_f
../../gcc/fortran/resolve.c:2937
0x8078e9 resolve_function
../../gcc/fortran/resolve.c:3281
0x8078e9 gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.c:7115
0x79a244 gfc_reduce_init_expr(gfc_expr*)
../../gcc/fortran/expr.c:3125
0x79d4b0 gfc_match_init_expr(gfc_expr**)
../../gcc/fortran/expr.c:3173
0x787c74 variable_decl
../../gcc/fortran/decl.c:3016
0x787c74 gfc_match_data_decl()
../../gcc/fortran/decl.c:6325
0x7f01d3 match_word
../../gcc/fortran/parse.c:65
0x7f01d3 decode_statement
../../gcc/fortran/parse.c:376
0x7f1c1a next_free
../../gcc/fortran/parse.c:1384
0x7f1c1a next_statement
../../gcc/fortran/parse.c:1616
0x7f333b parse_spec
../../gcc/fortran/parse.c:4151
0x7f610c parse_progunit
../../gcc/fortran/parse.c:6117
0x7f7891 gfc_parse_file()
../../gcc/fortran/parse.c:6658
0x84480f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:216
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102717] ICE in gfc_simplify_reshape, at fortran/simplify.c:6843
2021-10-12 17:33 [Bug fortran/102717] New: ICE in gfc_simplify_reshape, at fortran/simplify.c:6843 gscfq@t-online.de
@ 2021-10-12 21:33 ` anlauf at gcc dot gnu.org
2021-10-13 19:37 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-12 21:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102717
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Ever confirmed|0 |1
Last reconfirmed| |2021-10-12
CC| |anlauf at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from anlauf at gcc dot gnu.org ---
Tentative fix (not regtested):
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index f40e4930b58..5d29ab23dff 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -6840,7 +6840,13 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr
*shape_exp,
gfc_extract_int (e, &shape[rank]);
gcc_assert (rank >= 0 && rank < GFC_MAX_DIMENSIONS);
- gcc_assert (shape[rank] >= 0);
+ if (shape[rank] < 0)
+ {
+ gfc_error ("The SHAPE array for the RESHAPE intrinsic has a "
+ "negative value %d for dimension %d",
+ shape[rank], rank+1);
+ return &gfc_bad_expr;
+ }
rank++;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102717] ICE in gfc_simplify_reshape, at fortran/simplify.c:6843
2021-10-12 17:33 [Bug fortran/102717] New: ICE in gfc_simplify_reshape, at fortran/simplify.c:6843 gscfq@t-online.de
2021-10-12 21:33 ` [Bug fortran/102717] " anlauf at gcc dot gnu.org
@ 2021-10-13 19:37 ` anlauf at gcc dot gnu.org
2021-10-14 18:20 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-13 19:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102717
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 ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-October/056710.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102717] ICE in gfc_simplify_reshape, at fortran/simplify.c:6843
2021-10-12 17:33 [Bug fortran/102717] New: ICE in gfc_simplify_reshape, at fortran/simplify.c:6843 gscfq@t-online.de
2021-10-12 21:33 ` [Bug fortran/102717] " anlauf at gcc dot gnu.org
2021-10-13 19:37 ` anlauf at gcc dot gnu.org
@ 2021-10-14 18:20 ` cvs-commit at gcc dot gnu.org
2021-12-04 22:06 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-14 18:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102717
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:b47490c572c5938f887b54240af6096a7c90f640
commit r12-4415-gb47490c572c5938f887b54240af6096a7c90f640
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Oct 14 20:19:50 2021 +0200
Fortran: generate error message for negative elements in SHAPE array
gcc/fortran/ChangeLog:
PR fortran/102717
* simplify.c (gfc_simplify_reshape): Replace assert by error
message for negative elements in SHAPE array.
gcc/testsuite/ChangeLog:
PR fortran/102717
* gfortran.dg/reshape_shape_2.f90: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102717] ICE in gfc_simplify_reshape, at fortran/simplify.c:6843
2021-10-12 17:33 [Bug fortran/102717] New: ICE in gfc_simplify_reshape, at fortran/simplify.c:6843 gscfq@t-online.de
` (2 preceding siblings ...)
2021-10-14 18:20 ` cvs-commit at gcc dot gnu.org
@ 2021-12-04 22:06 ` cvs-commit at gcc dot gnu.org
2021-12-11 21:57 ` cvs-commit at gcc dot gnu.org
2021-12-11 21:59 ` anlauf at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-04 22:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102717
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:6fa3c73e88ccbb6fffb4169bcab830fc3f4f3c9a
commit r11-9358-g6fa3c73e88ccbb6fffb4169bcab830fc3f4f3c9a
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Oct 14 20:19:50 2021 +0200
Fortran: generate error message for negative elements in SHAPE array
gcc/fortran/ChangeLog:
PR fortran/102717
* simplify.c (gfc_simplify_reshape): Replace assert by error
message for negative elements in SHAPE array.
gcc/testsuite/ChangeLog:
PR fortran/102717
* gfortran.dg/reshape_shape_2.f90: New test.
(cherry picked from commit b47490c572c5938f887b54240af6096a7c90f640)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102717] ICE in gfc_simplify_reshape, at fortran/simplify.c:6843
2021-10-12 17:33 [Bug fortran/102717] New: ICE in gfc_simplify_reshape, at fortran/simplify.c:6843 gscfq@t-online.de
` (3 preceding siblings ...)
2021-12-04 22:06 ` cvs-commit at gcc dot gnu.org
@ 2021-12-11 21:57 ` cvs-commit at gcc dot gnu.org
2021-12-11 21:59 ` anlauf at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-11 21:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102717
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:fe00eaefa42d17de3c98c274967dd0f7ad7be463
commit r10-10333-gfe00eaefa42d17de3c98c274967dd0f7ad7be463
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Oct 14 20:19:50 2021 +0200
Fortran: generate error message for negative elements in SHAPE array
gcc/fortran/ChangeLog:
PR fortran/102717
* simplify.c (gfc_simplify_reshape): Replace assert by error
message for negative elements in SHAPE array.
gcc/testsuite/ChangeLog:
PR fortran/102717
* gfortran.dg/reshape_shape_2.f90: New test.
(cherry picked from commit b47490c572c5938f887b54240af6096a7c90f640)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102717] ICE in gfc_simplify_reshape, at fortran/simplify.c:6843
2021-10-12 17:33 [Bug fortran/102717] New: ICE in gfc_simplify_reshape, at fortran/simplify.c:6843 gscfq@t-online.de
` (4 preceding siblings ...)
2021-12-11 21:57 ` cvs-commit at gcc dot gnu.org
@ 2021-12-11 21:59 ` anlauf at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-11 21:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102717
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-12, and on 11- and 10-branch. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-12-11 21:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 17:33 [Bug fortran/102717] New: ICE in gfc_simplify_reshape, at fortran/simplify.c:6843 gscfq@t-online.de
2021-10-12 21:33 ` [Bug fortran/102717] " anlauf at gcc dot gnu.org
2021-10-13 19:37 ` anlauf at gcc dot gnu.org
2021-10-14 18:20 ` cvs-commit at gcc dot gnu.org
2021-12-04 22:06 ` cvs-commit at gcc dot gnu.org
2021-12-11 21:57 ` cvs-commit at gcc dot gnu.org
2021-12-11 21:59 ` anlauf at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).