* [Bug fortran/102619] [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
@ 2021-10-05 18:33 ` gscfq@t-online.de
2021-10-06 8:40 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2021-10-05 18:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
G. Steinmetz <gscfq@t-online.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---
While synonym z0.f90 compiles, the other variants don't :
$ cat z0.f90
program p
contains
function f(x) result(z)
real :: x(:)
real, allocatable :: z(:)
z = g(x)
end
function g(x)
real :: x(..)
real :: g(size(x))
end
end
$ cat z2.f90
program p
contains
function f(x) result(z)
real :: x(:)
real, allocatable :: z(:)
z = g(x)
end
function g(x)
real :: x(..)
real :: g(product(ubound(x)-lbound(x)+1))
end
end
$ cat z3.f90
program p
contains
function f(x) result(z)
real :: x(:)
real, allocatable :: z(:)
z = g(x)
end
function g(x)
real :: x(..)
real :: g(product(ubound(x)))
end
end
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102619] [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
2021-10-05 18:33 ` [Bug fortran/102619] " gscfq@t-online.de
@ 2021-10-06 8:40 ` rguenth at gcc dot gnu.org
2021-10-11 8:24 ` [Bug fortran/102619] [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805 marxin at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-06 8:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |10.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102619] [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
2021-10-05 18:33 ` [Bug fortran/102619] " gscfq@t-online.de
2021-10-06 8:40 ` rguenth at gcc dot gnu.org
@ 2021-10-11 8:24 ` marxin at gcc dot gnu.org
2022-06-28 10:46 ` [Bug fortran/102619] [10/11/12/13 " jakub at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-11 8:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Summary|[10/11/12 Regression] ICE |[10/11/12 Regression] ICE
|in |in
|gfc_conv_descriptor_dtype, |gfc_conv_descriptor_dtype,
|at |at
|fortran/trans-array.c:215 |fortran/trans-array.c:215
| |since
| |r9-6493-g0e3088806577e805
Last reconfirmed| |2021-10-11
CC| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started likely with r9-6493-g0e3088806577e805.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102619] [10/11/12/13 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
` (2 preceding siblings ...)
2021-10-11 8:24 ` [Bug fortran/102619] [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805 marxin at gcc dot gnu.org
@ 2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug fortran/102619] [11/12/13/14 " rguenth at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102619] [11/12/13/14 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
` (3 preceding siblings ...)
2022-06-28 10:46 ` [Bug fortran/102619] [10/11/12/13 " jakub at gcc dot gnu.org
@ 2023-07-07 10:41 ` rguenth at gcc dot gnu.org
2024-05-27 20:11 ` [Bug fortran/102619] [11/12/13/14/15 " anlauf at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102619] [11/12/13/14/15 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
` (4 preceding siblings ...)
2023-07-07 10:41 ` [Bug fortran/102619] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-05-27 20:11 ` anlauf at gcc dot gnu.org
2024-05-28 19:20 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-05-27 20:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #5 from anlauf at gcc dot gnu.org ---
The ICE occurs for both SUM and PRODUCT of SHAPE,LBOUND,UBOUND of the
assumed-rank dummy.
The ICE points to gfc_conv_intrinsic_arith:
4929 gfc_conv_ss_startstride (&loop);
The difference between assumed-shape vs. assumed-rank argument is:
(gdb) p *loop->ss->info->expr->shape->_mp_d
$86 = 1
vs.
(gdb) p loop->ss->info->expr->shape
$88 = (mpz_t *) 0x0
Now gfc_conv_ss_startstride should be able to handle assumed-rank,
but then we die here:
(gdb) l 4811,4826
4811 arg = expr->value.function.actual->expr;
4812 if (arg->rank == -1)
4813 {
4814 gfc_se se;
4815 tree rank, tmp;
4816
4817 /* The rank (hence the return value's shape) is
unknown,
4818 we have to retrieve it. */
4819 gfc_init_se (&se, NULL);
4820 se.descriptor_only = 1;
4821 gfc_conv_expr (&se, arg);
4822 /* This is a bare variable, so there is no
preliminary
4823 or cleanup code. */
4824 gcc_assert (se.pre.head == NULL_TREE
4825 && se.post.head == NULL_TREE);
4826 rank = gfc_conv_descriptor_rank (se.expr);
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102619] [11/12/13/14/15 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
` (5 preceding siblings ...)
2024-05-27 20:11 ` [Bug fortran/102619] [11/12/13/14/15 " anlauf at gcc dot gnu.org
@ 2024-05-28 19:20 ` anlauf at gcc dot gnu.org
2024-05-29 1:06 ` jvdelisle2 at gmail dot com
2024-05-29 18:07 ` mikael at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-05-28 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
--- Comment #6 from anlauf at gcc dot gnu.org ---
Created attachment 58302
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58302&action=edit
Partial patch
This change prevents the ICE and leads to a correct shape of the function
result for the following testcase:
program p
implicit none
real :: w(2,3)
real, allocatable :: y(:)
y = h(w)
print *, size (y) ! Should print 6
print *, y
deallocate (y)
contains
function h(x) result (g)
real :: x(..)
real :: g(product(shape(x)))
integer :: i
print *, shape (x)
print *, size (g)
g = [(real(i),i=1,size(g))]
print *, g
end
end
After the patch this prints:
2 3
6
1.00000000 2.00000000 3.00000000 4.00000000
5.00000000 6.00000000
1
1.00000000
So the function result is not allocated correctly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102619] [11/12/13/14/15 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
` (6 preceding siblings ...)
2024-05-28 19:20 ` anlauf at gcc dot gnu.org
@ 2024-05-29 1:06 ` jvdelisle2 at gmail dot com
2024-05-29 18:07 ` mikael at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle2 at gmail dot com @ 2024-05-29 1:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
Jerry DeLisle <jvdelisle2 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jvdelisle2 at gmail dot com
--- Comment #7 from Jerry DeLisle <jvdelisle2 at gmail dot com> ---
Interestingly, real :: x(:,:) works vs real :: x(..) in the function
declaration with your partial patch.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/102619] [11/12/13/14/15 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 since r9-6493-g0e3088806577e805
2021-10-05 18:32 [Bug fortran/102619] New: [10/11/12 Regression] ICE in gfc_conv_descriptor_dtype, at fortran/trans-array.c:215 gscfq@t-online.de
` (7 preceding siblings ...)
2024-05-29 1:06 ` jvdelisle2 at gmail dot com
@ 2024-05-29 18:07 ` mikael at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu.org @ 2024-05-29 18:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikael at gcc dot gnu.org
--- Comment #8 from Mikael Morin <mikael at gcc dot gnu.org> ---
The reason why the variable is not represented with an array descriptor is the
interface mapping mechanism to evaluate dummy array bounds.
gfc_add_interface_mapping replaces the normal variable decl with a
descriptorless (GFC_ARRAY_TYPE_P == 1) array. The rank for those is
GFC_TYPE_ARRAY_RANK, which is #defined to (TYPE_LANG_SPECIFIC(node)->rank).
And lang_type declares the rank field with:
int rank, corank;
so compile-time only rank.
gfc_set_interface_mapping_bounds uses a loop bounded by GFC_TYPE_ARRAY_RANK, so
it does nothing if the rank is -1 as with assumed rank.
So we expect a regular array descriptor from which we can get the runtime rank,
and we get a descriptorless array of rank -1 with unset bounds.
No wonder it doesn't work.
^ permalink raw reply [flat|nested] 10+ messages in thread