public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102716] New: ICE in gfc_validate_kind(): Got bad kind
@ 2021-10-12 17:32 gscfq@t-online.de
2021-10-12 21:12 ` [Bug fortran/102716] " 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:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102716
Bug ID: 102716
Summary: ICE in gfc_validate_kind(): Got bad kind
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) = shape([2], [1])
end
$ gfortran-12-20211010 -c z1.f90
f951: internal compiler error: gfc_validate_kind(): Got bad kind
0x794719 gfc_report_diagnostic
../../gcc/fortran/error.c:874
0x796287 gfc_internal_error(char const*, ...)
../../gcc/fortran/error.c:1494
0x8ca3b5 gfc_validate_kind(bt, int, bool)
../../gcc/fortran/trans-types.c:788
0x75e957 gfc_check_integer_range(__mpz_struct*, int)
../../gcc/fortran/arith.c:300
0x8201c0 range_check
../../gcc/fortran/simplify.c:86
0x82c544 range_check
../../gcc/fortran/simplify.c:7465
0x82c544 gfc_simplify_shape(gfc_expr*, gfc_expr*)
../../gcc/fortran/simplify.c:7448
0x7aa693 do_simplify
../../gcc/fortran/intrinsic.c:4664
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102716] ICE in gfc_validate_kind(): Got bad kind
2021-10-12 17:32 [Bug fortran/102716] New: ICE in gfc_validate_kind(): Got bad kind gscfq@t-online.de
@ 2021-10-12 21:12 ` anlauf at gcc dot gnu.org
2021-10-13 19:38 ` 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:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102716
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-10-12
Ever confirmed|0 |1
CC| |anlauf at gcc dot gnu.org
--- Comment #1 from anlauf at gcc dot gnu.org ---
Moving the check on the KIND argument seems to fix this (not regtested):
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 677209ee95e..cfaf9d26bbc 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5086,6 +5086,13 @@ gfc_check_shape (gfc_expr *source, gfc_expr *kind)
if (gfc_invalid_null_arg (source))
return false;
+ if (!kind_check (kind, 1, BT_INTEGER))
+ return false;
+ if (kind && !gfc_notify_std (GFC_STD_F2003, "%qs intrinsic "
+ "with KIND argument at %L",
+ gfc_current_intrinsic, &kind->where))
+ return false;
+
if (source->rank == 0 || source->expr_type != EXPR_VARIABLE)
return true;
@@ -5098,13 +5105,6 @@ gfc_check_shape (gfc_expr *source, gfc_expr *kind)
return false;
}
- if (!kind_check (kind, 1, BT_INTEGER))
- return false;
- if (kind && !gfc_notify_std (GFC_STD_F2003, "%qs intrinsic "
- "with KIND argument at %L",
- gfc_current_intrinsic, &kind->where))
- return false;
-
return true;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102716] ICE in gfc_validate_kind(): Got bad kind
2021-10-12 17:32 [Bug fortran/102716] New: ICE in gfc_validate_kind(): Got bad kind gscfq@t-online.de
2021-10-12 21:12 ` [Bug fortran/102716] " anlauf at gcc dot gnu.org
@ 2021-10-13 19:38 ` anlauf at gcc dot gnu.org
2021-10-14 18:18 ` 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:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102716
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #2 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-October/056711.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102716] ICE in gfc_validate_kind(): Got bad kind
2021-10-12 17:32 [Bug fortran/102716] New: ICE in gfc_validate_kind(): Got bad kind gscfq@t-online.de
2021-10-12 21:12 ` [Bug fortran/102716] " anlauf at gcc dot gnu.org
2021-10-13 19:38 ` anlauf at gcc dot gnu.org
@ 2021-10-14 18:18 ` cvs-commit at gcc dot gnu.org
2021-10-17 18:56 ` 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:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102716
--- 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:1b115daf62d94337b3d0b2962b0bbbf005a450e0
commit r12-4414-g1b115daf62d94337b3d0b2962b0bbbf005a450e0
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Oct 14 20:18:14 2021 +0200
Fortran: fix order of checks for the SHAPE intrinsic
gcc/fortran/ChangeLog:
PR fortran/102716
* check.c (gfc_check_shape): Reorder checks so that invalid KIND
arguments can be detected.
gcc/testsuite/ChangeLog:
PR fortran/102716
* gfortran.dg/shape_10.f90: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102716] ICE in gfc_validate_kind(): Got bad kind
2021-10-12 17:32 [Bug fortran/102716] New: ICE in gfc_validate_kind(): Got bad kind gscfq@t-online.de
` (2 preceding siblings ...)
2021-10-14 18:18 ` cvs-commit at gcc dot gnu.org
@ 2021-10-17 18:56 ` cvs-commit at gcc dot gnu.org
2021-10-23 14:34 ` cvs-commit at gcc dot gnu.org
2021-10-23 14:49 ` anlauf at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-17 18:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102716
--- 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:d97dbf60dda22e0668dc33ca3a536adcb0963a65
commit r11-9159-gd97dbf60dda22e0668dc33ca3a536adcb0963a65
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Oct 14 20:18:14 2021 +0200
Fortran: fix order of checks for the SHAPE intrinsic
gcc/fortran/ChangeLog:
PR fortran/102716
* check.c (gfc_check_shape): Reorder checks so that invalid KIND
arguments can be detected.
gcc/testsuite/ChangeLog:
PR fortran/102716
* gfortran.dg/shape_10.f90: New test.
(cherry picked from commit 1b115daf62d94337b3d0b2962b0bbbf005a450e0)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102716] ICE in gfc_validate_kind(): Got bad kind
2021-10-12 17:32 [Bug fortran/102716] New: ICE in gfc_validate_kind(): Got bad kind gscfq@t-online.de
` (3 preceding siblings ...)
2021-10-17 18:56 ` cvs-commit at gcc dot gnu.org
@ 2021-10-23 14:34 ` cvs-commit at gcc dot gnu.org
2021-10-23 14:49 ` anlauf at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-23 14:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102716
--- 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:bec9e43e1611b62732bf29763c3e8bddea480f62
commit r10-10231-gbec9e43e1611b62732bf29763c3e8bddea480f62
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Oct 14 20:18:14 2021 +0200
Fortran: fix order of checks for the SHAPE intrinsic
gcc/fortran/ChangeLog:
PR fortran/102716
* check.c (gfc_check_shape): Reorder checks so that invalid KIND
arguments can be detected.
gcc/testsuite/ChangeLog:
PR fortran/102716
* gfortran.dg/shape_10.f90: New test.
(cherry picked from commit 1b115daf62d94337b3d0b2962b0bbbf005a450e0)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/102716] ICE in gfc_validate_kind(): Got bad kind
2021-10-12 17:32 [Bug fortran/102716] New: ICE in gfc_validate_kind(): Got bad kind gscfq@t-online.de
` (4 preceding siblings ...)
2021-10-23 14:34 ` cvs-commit at gcc dot gnu.org
@ 2021-10-23 14:49 ` anlauf at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-23 14:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102716
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 mainline for gcc-12, and on 11- and 10-branch. Backporting to
9-branch
would require manual fixup and is not worth the effort. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-10-23 14:49 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:32 [Bug fortran/102716] New: ICE in gfc_validate_kind(): Got bad kind gscfq@t-online.de
2021-10-12 21:12 ` [Bug fortran/102716] " anlauf at gcc dot gnu.org
2021-10-13 19:38 ` anlauf at gcc dot gnu.org
2021-10-14 18:18 ` cvs-commit at gcc dot gnu.org
2021-10-17 18:56 ` cvs-commit at gcc dot gnu.org
2021-10-23 14:34 ` cvs-commit at gcc dot gnu.org
2021-10-23 14:49 ` 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).