public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107216] New: ICE in reduce_binary_aa, at fortran/arith.cc:1427
@ 2022-10-11 16:55 gscfq@t-online.de
2022-10-11 16:56 ` [Bug fortran/107216] " gscfq@t-online.de
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2022-10-11 16:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107216
Bug ID: 107216
Summary: ICE in reduce_binary_aa, at fortran/arith.cc:1427
Product: gcc
Version: 13.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 :
(valid examples)
$ cat z1.f90
program p
print *, [real :: 1, 2] * [real :: 1, (2)]
end
$ cat z2.f90
program p
print *, [real :: 1, (2)] * [real :: 1, 2]
end
$ gfortran-13-20221009 -c z1.f90
f951: internal compiler error: Segmentation fault
0xf3feef crash_signal
../../gcc/toplev.cc:314
0x1fe6c0c splay_tree_foreach
../../libiberty/splay-tree.c:577
0x7d85d4 gfc_constructor_copy(splay_tree_s*)
../../gcc/fortran/constructor.cc:104
0x7bf0a7 reduce_binary_aa
../../gcc/fortran/arith.cc:1427
0x7bf0a7 reduce_binary
../../gcc/fortran/arith.cc:1478
0x7bf0ec reduce_binary_aa
../../gcc/fortran/arith.cc:1437
0x7bf0ec reduce_binary
../../gcc/fortran/arith.cc:1478
0x7bf5d2 eval_intrinsic
../../gcc/fortran/arith.cc:1654
0x83208c match_add_operand
../../gcc/fortran/matchexp.cc:392
0x83223c match_level_2
../../gcc/fortran/matchexp.cc:480
0x832392 match_level_3
../../gcc/fortran/matchexp.cc:551
0x832484 match_level_4
../../gcc/fortran/matchexp.cc:599
0x832484 match_and_operand
../../gcc/fortran/matchexp.cc:693
0x832672 match_or_operand
../../gcc/fortran/matchexp.cc:722
0x832742 match_equiv_operand
../../gcc/fortran/matchexp.cc:765
0x832814 match_level_5
../../gcc/fortran/matchexp.cc:811
0x831be1 gfc_match_expr(gfc_expr**)
../../gcc/fortran/matchexp.cc:870
0x8192d9 match_io_element
../../gcc/fortran/io.cc:3668
0x81bc0a match_io_list
../../gcc/fortran/io.cc:3716
0x81c00e match_io
../../gcc/fortran/io.cc:4394
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/107216] ICE in reduce_binary_aa, at fortran/arith.cc:1427
2022-10-11 16:55 [Bug fortran/107216] New: ICE in reduce_binary_aa, at fortran/arith.cc:1427 gscfq@t-online.de
@ 2022-10-11 16:56 ` gscfq@t-online.de
2022-10-12 18:48 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2022-10-11 16:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107216
G. Steinmetz <gscfq@t-online.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-invalid-code,
| |ice-on-valid-code
--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---
And some invalid examples :
$ cat zz1.f90
program p
print *, [real :: 1, 2] * [real :: (1), +('1')]
end
$ cat zz2.f90
program p
print *, [real :: (1), +('1')] * [real :: 1, 2]
end
$ cat zz3.f90
program p
print *, [real :: 1, 2] * [real :: (1), +(.true.)]
end
$ cat zz4.f90
program p
print *, [real :: (1), +(.true.)] * [real :: 1, 2]
end
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/107216] ICE in reduce_binary_aa, at fortran/arith.cc:1427
2022-10-11 16:55 [Bug fortran/107216] New: ICE in reduce_binary_aa, at fortran/arith.cc:1427 gscfq@t-online.de
2022-10-11 16:56 ` [Bug fortran/107216] " gscfq@t-online.de
@ 2022-10-12 18:48 ` anlauf at gcc dot gnu.org
2022-10-12 19:02 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-12 18:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107216
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2022-10-12
Status|UNCONFIRMED |NEW
--- Comment #2 from anlauf at gcc dot gnu.org ---
Confirmed.
Strange. Removing any of the typespecs in the array constructors avoids
the issue, i.e.
print *, [real :: 1, 2] * [ 1, (2)]
would just fine.
For z1.f90, I find:
(gdb) p op2->expr_type
$9 = EXPR_FUNCTION
in reduce_binary before we call reduce_binary_aa and everything goes boom.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/107216] ICE in reduce_binary_aa, at fortran/arith.cc:1427
2022-10-11 16:55 [Bug fortran/107216] New: ICE in reduce_binary_aa, at fortran/arith.cc:1427 gscfq@t-online.de
2022-10-11 16:56 ` [Bug fortran/107216] " gscfq@t-online.de
2022-10-12 18:48 ` anlauf at gcc dot gnu.org
@ 2022-10-12 19:02 ` anlauf at gcc dot gnu.org
2022-10-17 17:26 ` cvs-commit at gcc dot gnu.org
2022-10-17 17:37 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-12 19:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107216
--- Comment #3 from anlauf at gcc dot gnu.org ---
Potential patch:
diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc
index bbdb5b392fc..9bec299f160 100644
--- a/gcc/fortran/array.cc
+++ b/gcc/fortran/array.cc
@@ -1205,6 +1205,10 @@ walk_array_constructor (gfc_typespec *ts,
gfc_constructor_base head)
for (c = gfc_constructor_first (head); c; c = gfc_constructor_next (c))
{
e = c->expr;
+
+ if (e->expr_type == EXPR_OP)
+ gfc_simplify_expr (e, 0);
+
if (e->expr_type == EXPR_ARRAY && e->ts.type == BT_UNKNOWN
&& !e->ref && e->value.constructor)
{
This seems to fix pr107219, too.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/107216] ICE in reduce_binary_aa, at fortran/arith.cc:1427
2022-10-11 16:55 [Bug fortran/107216] New: ICE in reduce_binary_aa, at fortran/arith.cc:1427 gscfq@t-online.de
` (2 preceding siblings ...)
2022-10-12 19:02 ` anlauf at gcc dot gnu.org
@ 2022-10-17 17:26 ` cvs-commit at gcc dot gnu.org
2022-10-17 17:37 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-17 17:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107216
--- Comment #4 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:d45af5c2eb1ba1e48449d8f3c5b4e3994a956f92
commit r13-3340-gd45af5c2eb1ba1e48449d8f3c5b4e3994a956f92
Author: Harald Anlauf <anlauf@gmx.de>
Date: Sat Oct 15 21:56:56 2022 +0200
Fortran: handle bad array ctors with typespec [PR93483, PR107216, PR107219]
gcc/fortran/ChangeLog:
PR fortran/93483
PR fortran/107216
PR fortran/107219
* arith.cc (reduce_unary): Handled expressions are EXP_CONSTANT and
EXPR_ARRAY. Do not attempt to reduce otherwise.
(reduce_binary_ac): Likewise.
(reduce_binary_ca): Likewise.
(reduce_binary_aa): Moved check for EXP_CONSTANT and EXPR_ARRAY
from here ...
(reduce_binary): ... to here.
(eval_intrinsic): Catch failed reductions.
* gfortran.h (GFC_INTRINSIC_OPS): New enum ARITH_NOT_REDUCED to
keep
track of expressions that were not reduced by the arithmetic
evaluation
code.
gcc/testsuite/ChangeLog:
PR fortran/93483
PR fortran/107216
PR fortran/107219
* gfortran.dg/array_constructor_56.f90: New test.
* gfortran.dg/array_constructor_57.f90: New test.
Co-authored-by: Mikael Morin <mikael@gcc.gnu.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/107216] ICE in reduce_binary_aa, at fortran/arith.cc:1427
2022-10-11 16:55 [Bug fortran/107216] New: ICE in reduce_binary_aa, at fortran/arith.cc:1427 gscfq@t-online.de
` (3 preceding siblings ...)
2022-10-17 17:26 ` cvs-commit at gcc dot gnu.org
@ 2022-10-17 17:37 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-17 17:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107216
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed for gcc-13. Closing.
Thanks for insisting!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-17 17:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-11 16:55 [Bug fortran/107216] New: ICE in reduce_binary_aa, at fortran/arith.cc:1427 gscfq@t-online.de
2022-10-11 16:56 ` [Bug fortran/107216] " gscfq@t-online.de
2022-10-12 18:48 ` anlauf at gcc dot gnu.org
2022-10-12 19:02 ` anlauf at gcc dot gnu.org
2022-10-17 17:26 ` cvs-commit at gcc dot gnu.org
2022-10-17 17:37 ` 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).