* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
@ 2021-09-28 19:47 ` anlauf at gcc dot gnu.org
2021-09-29 21:14 ` anlauf at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-28 19:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-09-28
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
2021-09-28 19:47 ` [Bug fortran/102521] " anlauf at gcc dot gnu.org
@ 2021-09-29 21:14 ` anlauf at gcc dot gnu.org
2021-10-01 18:43 ` anlauf at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-29 21:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #2 from anlauf at gcc dot gnu.org ---
Possibly related:
program p
type t
integer :: n
end type
type(t), parameter :: a(4) = t(1)
type(t), parameter :: c(*) = a
end
This gives an ICE already in add_init_expr_to_sym.
So we likely screw up long before trans*.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
2021-09-28 19:47 ` [Bug fortran/102521] " anlauf at gcc dot gnu.org
2021-09-29 21:14 ` anlauf at gcc dot gnu.org
@ 2021-10-01 18:43 ` anlauf at gcc dot gnu.org
2021-10-02 19:39 ` anlauf at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-01 18:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
--- Comment #3 from anlauf at gcc dot gnu.org ---
The code works if we replace the r.h.s. in the initialization by an array:
program p
type t
integer :: n
end type
! type(t), parameter :: a(4) = t(1) ! ICE
type(t), parameter :: a(4) = spread (t(1), dim=1, ncopies=4) ! works
type(t), parameter :: c(*) = a
type(t), parameter :: b(2,2) = reshape(a, [2,2])
print *, b
end
The code in add_init_expr_to_sym looks fishy. We might possibly handle the
ICEing code here but don't:
2224 /* Add initializer. Make sure we keep the ranks sane. */
2225 if (sym->attr.dimension && init->rank == 0)
2226 {
2227 mpz_t size;
2228 gfc_expr *array;
2229 int n;
2230 if (sym->attr.flavor == FL_PARAMETER
2231 && init->expr_type == EXPR_CONSTANT
2232 && spec_size (sym->as, &size)
2233 && mpz_cmp_si (size, 0) > 0)
(gdb) p init->expr_type
$1 = EXPR_STRUCTURE
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
` (2 preceding siblings ...)
2021-10-01 18:43 ` anlauf at gcc dot gnu.org
@ 2021-10-02 19:39 ` anlauf at gcc dot gnu.org
2021-10-03 19:22 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-02 19:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
--- Comment #4 from anlauf at gcc dot gnu.org ---
Tentative patch:
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index b3c65b7175b..cebc59e4ab5 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2228,12 +2228,15 @@ add_init_expr_to_sym (const char *name, gfc_expr
**initp, locus *var_locus)
gfc_expr *array;
int n;
if (sym->attr.flavor == FL_PARAMETER
- && init->expr_type == EXPR_CONSTANT
- && spec_size (sym->as, &size)
- && mpz_cmp_si (size, 0) > 0)
+ && (init->expr_type == EXPR_CONSTANT
+ || init->expr_type == EXPR_STRUCTURE)
+ && spec_size (sym->as, &size)
+ && mpz_cmp_si (size, 0) > 0)
{
array = gfc_get_array_expr (init->ts.type, init->ts.kind,
&init->where);
+ if (init->ts.type == BT_DERIVED)
+ array->ts.u.derived = init->ts.u.derived;
for (n = 0; n < (int)mpz_get_si (size); n++)
gfc_constructor_append_expr (&array->value.constructor,
n == 0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
` (3 preceding siblings ...)
2021-10-02 19:39 ` anlauf at gcc dot gnu.org
@ 2021-10-03 19:22 ` anlauf at gcc dot gnu.org
2021-10-10 18:12 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-03 19:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
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 #5 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-October/056617.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
` (4 preceding siblings ...)
2021-10-03 19:22 ` anlauf at gcc dot gnu.org
@ 2021-10-10 18:12 ` cvs-commit at gcc dot gnu.org
2021-11-07 20:54 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-10 18:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
--- Comment #6 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:74ccca380cde5e79e082d39214b306a90ded0344
commit r12-4278-g74ccca380cde5e79e082d39214b306a90ded0344
Author: Harald Anlauf <anlauf@gmx.de>
Date: Sun Oct 10 20:11:43 2021 +0200
Fortran: handle initialization of derived type parameter arrays from scalar
gcc/fortran/ChangeLog:
PR fortran/99348
PR fortran/102521
* decl.c (add_init_expr_to_sym): Extend initialization of
parameter arrays from scalars to handle derived types.
gcc/testsuite/ChangeLog:
PR fortran/99348
PR fortran/102521
* gfortran.dg/parameter_array_init_8.f90: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
` (5 preceding siblings ...)
2021-10-10 18:12 ` cvs-commit at gcc dot gnu.org
@ 2021-11-07 20:54 ` cvs-commit at gcc dot gnu.org
2021-11-13 20:15 ` cvs-commit at gcc dot gnu.org
2021-11-13 20:16 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-07 20:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
--- Comment #7 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:1b740d8000cac8048c728fb0bd75c71464eeee29
commit r11-9213-g1b740d8000cac8048c728fb0bd75c71464eeee29
Author: Harald Anlauf <anlauf@gmx.de>
Date: Sun Oct 10 20:11:43 2021 +0200
Fortran: handle initialization of derived type parameter arrays from scalar
gcc/fortran/ChangeLog:
PR fortran/99348
PR fortran/102521
* decl.c (add_init_expr_to_sym): Extend initialization of
parameter arrays from scalars to handle derived types.
gcc/testsuite/ChangeLog:
PR fortran/99348
PR fortran/102521
* gfortran.dg/parameter_array_init_8.f90: New test.
(cherry picked from commit 74ccca380cde5e79e082d39214b306a90ded0344)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
` (6 preceding siblings ...)
2021-11-07 20:54 ` cvs-commit at gcc dot gnu.org
@ 2021-11-13 20:15 ` cvs-commit at gcc dot gnu.org
2021-11-13 20:16 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-13 20:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
--- Comment #8 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:cb85933717e52f1cd91786e6bb595494629ca5c9
commit r10-10267-gcb85933717e52f1cd91786e6bb595494629ca5c9
Author: Harald Anlauf <anlauf@gmx.de>
Date: Sun Oct 10 20:11:43 2021 +0200
Fortran: handle initialization of derived type parameter arrays from scalar
gcc/fortran/ChangeLog:
PR fortran/99348
PR fortran/102521
* decl.c (add_init_expr_to_sym): Extend initialization of
parameter arrays from scalars to handle derived types.
gcc/testsuite/ChangeLog:
PR fortran/99348
PR fortran/102521
* gfortran.dg/parameter_array_init_8.f90: New test.
(cherry picked from commit 74ccca380cde5e79e082d39214b306a90ded0344)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240
2021-09-28 19:10 [Bug fortran/102521] New: ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 gscfq@t-online.de
` (7 preceding siblings ...)
2021-11-13 20:15 ` cvs-commit at gcc dot gnu.org
@ 2021-11-13 20:16 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-11-13 20:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102521
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 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] 10+ messages in thread