public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324
@ 2021-07-20 17:02 gscfq@t-online.de
2021-07-20 17:02 ` [Bug fortran/101536] " gscfq@t-online.de
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2021-07-20 17:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536
Bug ID: 101536
Summary: ICE in gfc_conv_expr_descriptor, at
fortran/trans-array.c:7324
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: ---
An invalid argument affects versions down to at least r5 :
$ cat z1.f90
program p
type t
end type
contains
integer function f(x)
class(t), allocatable :: x(:)
f = size(x(1))
end
end
$ cat z2.f90
program p
type t
end type
contains
integer function f(x)
class(t) :: x(:)
f = size(x(1))
end
end
$ gfortran-12-20210718 -c z1.f90
z1.f90:7:20:
7 | f = size(x(1))
| 1
internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:7324
0x8093ab gfc_conv_expr_descriptor(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-array.c:7324
0x84c9a2 gfc_conv_intrinsic_size
../../gcc/fortran/trans-intrinsic.c:8062
0x86a6b7 gfc_conv_intrinsic_function(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-intrinsic.c:10702
0x839faa gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:9018
0x846081 gfc_trans_assignment_1
../../gcc/fortran/trans-expr.c:11311
0x7f57f7 trans_code
../../gcc/fortran/trans.c:1918
0x8287d5 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6898
0x8284dc gfc_generate_contained_functions
../../gcc/fortran/trans-decl.c:5892
0x8284dc gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6830
0x7a0026 translate_all_program_units
../../gcc/fortran/parse.c:6464
0x7a0026 gfc_parse_file()
../../gcc/fortran/parse.c:6733
0x7ecf1f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:216
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/101536] ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324
2021-07-20 17:02 [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 gscfq@t-online.de
@ 2021-07-20 17:02 ` gscfq@t-online.de
2021-07-20 20:46 ` anlauf at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2021-07-20 17:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536
G. Steinmetz <gscfq@t-online.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-invalid-code
--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---
Detected with "type" instead of "class" :
$ cat z0.f90
program p
type t
end type
contains
integer function f(x)
type(t), allocatable :: x(:)
f = size(x(1))
end
end
$ gfortran-12-20210718 -c z0.f90
z0.f90:7:15:
7 | f = size(x(1))
| 1
Error: 'array' argument of 'size' intrinsic at (1) must be an array
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/101536] ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324
2021-07-20 17:02 [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 gscfq@t-online.de
2021-07-20 17:02 ` [Bug fortran/101536] " gscfq@t-online.de
@ 2021-07-20 20:46 ` anlauf at gcc dot gnu.org
2021-07-21 20:27 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-07-20 20:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-07-20
--- Comment #2 from anlauf at gcc dot gnu.org ---
Confirmed.
I am testing the following:
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 27bf3a7eafe..6d2d9fe4007 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -735,6 +735,10 @@ array_check (gfc_expr *e, int n)
&& CLASS_DATA (e)->attr.dimension
&& CLASS_DATA (e)->as->rank)
{
+ if (e->ref && e->ref->type == REF_ARRAY
+ && e->ref->u.ar.type == AR_ELEMENT)
+ goto error;
+
gfc_add_class_array_ref (e);
return true;
}
@@ -742,6 +746,7 @@ array_check (gfc_expr *e, int n)
if (e->rank != 0 && e->ts.type != BT_PROCEDURE)
return true;
+error:
gfc_error ("%qs argument of %qs intrinsic at %L must be an array",
gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
&e->where);
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/101536] ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324
2021-07-20 17:02 [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 gscfq@t-online.de
2021-07-20 17:02 ` [Bug fortran/101536] " gscfq@t-online.de
2021-07-20 20:46 ` anlauf at gcc dot gnu.org
@ 2021-07-21 20:27 ` anlauf at gcc dot gnu.org
2021-07-23 19:00 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-07-21 20:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536
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
CC| |anlauf at gcc dot gnu.org
--- Comment #3 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2021-July/056263.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/101536] ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324
2021-07-20 17:02 [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 gscfq@t-online.de
` (2 preceding siblings ...)
2021-07-21 20:27 ` anlauf at gcc dot gnu.org
@ 2021-07-23 19:00 ` cvs-commit at gcc dot gnu.org
2021-07-28 19:15 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-23 19:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536
--- 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:e314cfc371d8b2405a1d81e51b90f9fb24b9061f
commit r12-2500-ge314cfc371d8b2405a1d81e51b90f9fb24b9061f
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Jul 23 21:00:10 2021 +0200
Fortran: extend check for array arguments and reject CLASS array elements.
gcc/fortran/ChangeLog:
PR fortran/101536
* check.c (array_check): Adjust check for the case of CLASS
arrays.
gcc/testsuite/ChangeLog:
PR fortran/101536
* gfortran.dg/pr101536.f90: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/101536] ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324
2021-07-20 17:02 [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 gscfq@t-online.de
` (3 preceding siblings ...)
2021-07-23 19:00 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 19:15 ` cvs-commit at gcc dot gnu.org
2021-07-30 20:06 ` cvs-commit at gcc dot gnu.org
2021-07-30 20:09 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 19:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536
--- Comment #5 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:35c7067f7b31682e4d5da7ec83759ab1a17cead9
commit r11-8813-g35c7067f7b31682e4d5da7ec83759ab1a17cead9
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Jul 23 21:00:10 2021 +0200
Fortran: extend check for array arguments and reject CLASS array elements.
gcc/fortran/ChangeLog:
PR fortran/101536
* check.c (array_check): Adjust check for the case of CLASS
arrays.
gcc/testsuite/ChangeLog:
PR fortran/101536
* gfortran.dg/pr101536.f90: New test.
(cherry picked from commit e314cfc371d8b2405a1d81e51b90f9fb24b9061f)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/101536] ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324
2021-07-20 17:02 [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 gscfq@t-online.de
` (4 preceding siblings ...)
2021-07-28 19:15 ` cvs-commit at gcc dot gnu.org
@ 2021-07-30 20:06 ` cvs-commit at gcc dot gnu.org
2021-07-30 20:09 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-30 20:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536
--- Comment #6 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:95cda605a8f7e6b54c428b7d2c37b4f2ebe4a8d8
commit r10-10014-g95cda605a8f7e6b54c428b7d2c37b4f2ebe4a8d8
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Jul 23 21:00:10 2021 +0200
Fortran: extend check for array arguments and reject CLASS array elements.
gcc/fortran/ChangeLog:
PR fortran/101536
* check.c (array_check): Adjust check for the case of CLASS
arrays.
gcc/testsuite/ChangeLog:
PR fortran/101536
* gfortran.dg/pr101536.f90: New test.
(cherry picked from commit e314cfc371d8b2405a1d81e51b90f9fb24b9061f)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/101536] ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324
2021-07-20 17:02 [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 gscfq@t-online.de
` (5 preceding siblings ...)
2021-07-30 20:06 ` cvs-commit at gcc dot gnu.org
@ 2021-07-30 20:09 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-07-30 20:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101536
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Target Milestone|--- |10.4
Resolution|--- |FIXED
--- Comment #7 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-12, and on 11- and 10-branch. Not a regression,
so not backporting further. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-07-30 20:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 17:02 [Bug fortran/101536] New: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7324 gscfq@t-online.de
2021-07-20 17:02 ` [Bug fortran/101536] " gscfq@t-online.de
2021-07-20 20:46 ` anlauf at gcc dot gnu.org
2021-07-21 20:27 ` anlauf at gcc dot gnu.org
2021-07-23 19:00 ` cvs-commit at gcc dot gnu.org
2021-07-28 19:15 ` cvs-commit at gcc dot gnu.org
2021-07-30 20:06 ` cvs-commit at gcc dot gnu.org
2021-07-30 20:09 ` 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).