* [Bug fortran/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 gscfq@t-online.de
@ 2021-03-02 19:00 ` gscfq@t-online.de
2021-03-03 7:54 ` marxin at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2021-03-02 19:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99348
G. Steinmetz <gscfq@t-online.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---
Compiles and works without "parameter" :
$ cat z2.f90
program p
type t
character(3) :: c
end type
type(t) :: x(1) = t('abc')
print *, x%c%len
end
$ gfortran-11-20210228 z1.f90 && ./a.out
3
$
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 gscfq@t-online.de
2021-03-02 19:00 ` [Bug fortran/99348] " gscfq@t-online.de
@ 2021-03-03 7:54 ` marxin at gcc dot gnu.org
2021-03-26 21:08 ` anlauf at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-03 7:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99348
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |marxin at gcc dot gnu.org,
| |pault at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2021-03-03
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r9-3803-ga5fbc2f36a291cbe.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 gscfq@t-online.de
2021-03-02 19:00 ` [Bug fortran/99348] " gscfq@t-online.de
2021-03-03 7:54 ` marxin at gcc dot gnu.org
@ 2021-03-26 21:08 ` anlauf at gcc dot gnu.org
2021-10-01 21:18 ` 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-03-26 21:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99348
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #3 from anlauf at gcc dot gnu.org ---
There's no ICE when x is scalar:
type(t), parameter :: x = t('abc')
With the following patch we avoid the NULL pointer dereference at
resolve.c:1286
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 1c9b0c5cb62..0b9e11cdd41 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1282,7 +1282,7 @@ resolve_structure_cons (gfc_expr *expr, int init)
/* A constructor may have references if it is the result of substituting a
parameter variable. In this case we just pull out the component we
want. */
- if (expr->ref)
+ if (expr->ref && expr->ref->u.c.sym)
comp = expr->ref->u.c.sym->components;
else
comp = expr->ts.u.derived->components;
but later run into an issue at expr.c:1917:
1913 for (c = gfc_constructor_first
(p->value.constructor);
1914 c; c = gfc_constructor_next (c))
1915 {
1916 c->expr->ref = gfc_copy_ref (p->ref->next);
1917 if (!simplify_const_ref (c->expr))
1918 return false;
1919 }
(gdb) p c->expr->ts.u.cl->length
$104 = (gfc_expr *) 0x0
(gdb) p c->expr->value.character.length
$105 = 3
This leads to an ICE during processing simplify_const_ref.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 gscfq@t-online.de
` (2 preceding siblings ...)
2021-03-26 21:08 ` anlauf at gcc dot gnu.org
@ 2021-10-01 21:18 ` anlauf at gcc dot gnu.org
2021-10-10 18:12 ` cvs-commit 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-01 21:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99348
--- Comment #4 from anlauf at gcc dot gnu.org ---
This might actually be related to pr102521. The following variant compiles ok:
program p
type t
character(3) :: c
end type
! type(t), parameter :: x(1) = t('abc')
type(t), parameter :: x(1) = spread (t('abc'), dim=1, ncopies=1)
print *, x%c%len
end
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 gscfq@t-online.de
` (3 preceding siblings ...)
2021-10-01 21:18 ` anlauf at gcc dot gnu.org
@ 2021-10-10 18:12 ` cvs-commit at gcc dot gnu.org
2021-10-10 18:18 ` anlauf at gcc dot gnu.org
` (3 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=99348
--- Comment #5 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/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 gscfq@t-online.de
` (4 preceding siblings ...)
2021-10-10 18:12 ` cvs-commit at gcc dot gnu.org
@ 2021-10-10 18:18 ` anlauf 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: anlauf at gcc dot gnu.org @ 2021-10-10 18:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99348
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 gscfq@t-online.de
` (5 preceding siblings ...)
2021-10-10 18:18 ` anlauf 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:17 ` 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=99348
--- Comment #6 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/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 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:17 ` 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=99348
--- Comment #7 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/99348] ICE in resolve_structure_cons, at fortran/resolve.c:1286
2021-03-02 18:59 [Bug fortran/99348] New: ICE in resolve_structure_cons, at fortran/resolve.c:1286 gscfq@t-online.de
` (7 preceding siblings ...)
2021-11-13 20:15 ` cvs-commit at gcc dot gnu.org
@ 2021-11-13 20:17 ` 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:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99348
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 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