public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103474] New: ICE in simplify_cobound, at fortran/simplify.c:4415
@ 2021-11-29 18:51 gscfq@t-online.de
2021-11-29 20:40 ` [Bug fortran/103474] " kargl at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2021-11-29 18:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103474
Bug ID: 103474
Summary: ICE in simplify_cobound, at fortran/simplify.c:4415
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: ---
With a missing attribute allocatable or pointer :
(affects version down to at least r5)
(gcc configured with --enable-checking=yes)
$ cat z1.f90
program p
type t
integer :: a
end type
class(t) :: x[:]
print *, ucobound(x)
end
$ cat z2.f90 # ok
program p
type t
integer :: a
end type
class(t), allocatable :: x[:]
print *, ucobound(x)
end
$ gfortran-12-20211128 -c z1.f90 -fcoarray=lib
z1.f90:5:19:
5 | class(t) :: x[:]
| 1
Error: Coarray variable 'x' at (1) shall not have codimensions with deferred
shape
f951: internal compiler error: in simplify_cobound, at fortran/simplify.c:4415
0x866f12 simplify_cobound
../../gcc/fortran/simplify.c:4415
0x7ee36a do_simplify
../../gcc/fortran/intrinsic.c:4655
0x7f94aa gfc_intrinsic_func_interface(gfc_expr*, int)
../../gcc/fortran/intrinsic.c:5034
0x84d41c resolve_unknown_f
../../gcc/fortran/resolve.c:2972
0x84d41c resolve_function
../../gcc/fortran/resolve.c:3329
0x84d41c gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.c:7166
0x853944 gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.c:7133
0x853944 gfc_resolve_code(gfc_code*, gfc_namespace*)
../../gcc/fortran/resolve.c:11928
0x85228f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
../../gcc/fortran/resolve.c:10944
0x852658 gfc_resolve_code(gfc_code*, gfc_namespace*)
../../gcc/fortran/resolve.c:11918
0x854f97 resolve_codes
../../gcc/fortran/resolve.c:17536
0x85505e gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.c:17571
0x83d314 resolve_all_program_units
../../gcc/fortran/parse.c:6573
0x83d314 gfc_parse_file()
../../gcc/fortran/parse.c:6829
0x88b37f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:216
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103474] ICE in simplify_cobound, at fortran/simplify.c:4415
2021-11-29 18:51 [Bug fortran/103474] New: ICE in simplify_cobound, at fortran/simplify.c:4415 gscfq@t-online.de
@ 2021-11-29 20:40 ` kargl at gcc dot gnu.org
2022-01-26 17:24 ` gscfq@t-online.de
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-11-29 20:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103474
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-11-29
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org ---
An gcc_unreachable() conditional can obviously be reached with invalid code.
Return NULL instead of an ICE.
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index c9e13b59da9..2c4240c8f0d 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4411,12 +4411,9 @@ simplify_cobound (gfc_expr *array, gfc_expr *dim,
gfc_expr *kind, int upper)
}
}
- if (!as)
- gcc_unreachable ();
-
done:
- if (as->cotype == AS_DEFERRED || as->cotype == AS_ASSUMED_SHAPE)
+ if (!as || as->cotype == AS_DEFERRED || as->cotype == AS_ASSUMED_SHAPE)
return NULL;
if (dim == NULL)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103474] ICE in simplify_cobound, at fortran/simplify.c:4415
2021-11-29 18:51 [Bug fortran/103474] New: ICE in simplify_cobound, at fortran/simplify.c:4415 gscfq@t-online.de
2021-11-29 20:40 ` [Bug fortran/103474] " kargl at gcc dot gnu.org
@ 2022-01-26 17:24 ` gscfq@t-online.de
2022-10-20 21:01 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2022-01-26 17:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103474
--- Comment #2 from G. Steinmetz <gscfq@t-online.de> ---
Additionally :
$ cat z3.f90
program p
type t
integer :: a
end type
class(t) :: x[:]
if ( any(lcobound(x) < 1) ) stop
end
$ cat zz1.f90
program p
type t
integer :: a
end type
class(t), allocatable :: x[:]
print *, lcobound(x%a)
end
$ cat zz2.f90
program p
type t
integer :: a(2)
end type
class(t), allocatable :: x[:]
print *, lcobound(x%a)
end
$ gfortran-12-20220123 -c zz1.f90 -fcoarray=single # release version
f951: internal compiler error: in simplify_cobound, at fortran/simplify.cc:4383
0x77ac55 simplify_cobound
../../gcc/fortran/simplify.cc:4383
0x70210a do_simplify
../../gcc/fortran/intrinsic.cc:4676
0x70cfea gfc_intrinsic_func_interface(gfc_expr*, int)
../../gcc/fortran/intrinsic.cc:5055
0x761368 resolve_unknown_f
../../gcc/fortran/resolve.cc:2972
0x761368 resolve_function
../../gcc/fortran/resolve.cc:3329
0x761368 gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.cc:7169
0x767754 gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.cc:7136
0x767754 gfc_resolve_code(gfc_code*, gfc_namespace*)
../../gcc/fortran/resolve.cc:11928
0x76610f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
../../gcc/fortran/resolve.cc:10944
0x766468 gfc_resolve_code(gfc_code*, gfc_namespace*)
../../gcc/fortran/resolve.cc:11918
0x768da7 resolve_codes
../../gcc/fortran/resolve.cc:17537
0x768e6e gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.cc:17572
0x751194 resolve_all_program_units
../../gcc/fortran/parse.cc:6586
0x751194 gfc_parse_file()
../../gcc/fortran/parse.cc:6842
0x79e86f gfc_be_parse_file
../../gcc/fortran/f95-lang.cc:216
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103474] ICE in simplify_cobound, at fortran/simplify.c:4415
2021-11-29 18:51 [Bug fortran/103474] New: ICE in simplify_cobound, at fortran/simplify.c:4415 gscfq@t-online.de
2021-11-29 20:40 ` [Bug fortran/103474] " kargl at gcc dot gnu.org
2022-01-26 17:24 ` gscfq@t-online.de
@ 2022-10-20 21:01 ` anlauf at gcc dot gnu.org
2022-10-25 19:27 ` anlauf at gcc dot gnu.org
2022-10-26 20:44 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-20 21:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103474
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 ---
The patch in comment#1 fixes comment#0, but not comment#2, which hits another
assert. That one needs additionally something like
@@ -4353,7 +4356,8 @@ simplify_cobound (gfc_expr *array, gfc_expr *dim,
gfc_expr *kind, int upper)
case AR_ELEMENT:
if (ref->u.ar.as->corank > 0)
{
- gcc_assert (as == ref->u.ar.as);
+// gcc_assert (as == ref->u.ar.as);
+ as = ref->u.ar.as;
goto done;
}
as = NULL;
However, that would lead to silent acceptance of invalid code which needs
checking elsewhere.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103474] ICE in simplify_cobound, at fortran/simplify.c:4415
2021-11-29 18:51 [Bug fortran/103474] New: ICE in simplify_cobound, at fortran/simplify.c:4415 gscfq@t-online.de
` (2 preceding siblings ...)
2022-10-20 21:01 ` anlauf at gcc dot gnu.org
@ 2022-10-25 19:27 ` anlauf at gcc dot gnu.org
2022-10-26 20:44 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-25 19:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103474
--- Comment #4 from anlauf at gcc dot gnu.org ---
Another part which is needed to avoid an ice-on-valid code:
(Note F2018:5.4.7(5): A subobject of a coarray is a coarray if ...)
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 69d0b57c688..ef8f042a7e4 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -5845,6 +5845,8 @@ gfc_get_corank (gfc_expr *e)
if (ref->type == REF_ARRAY)
corank = ref->u.ar.as->corank;
gcc_assert (ref->type != REF_SUBSTRING);
+ if (corank)
+ break;
}
return corank;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103474] ICE in simplify_cobound, at fortran/simplify.c:4415
2021-11-29 18:51 [Bug fortran/103474] New: ICE in simplify_cobound, at fortran/simplify.c:4415 gscfq@t-online.de
` (3 preceding siblings ...)
2022-10-25 19:27 ` anlauf at gcc dot gnu.org
@ 2022-10-26 20:44 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-26 20:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103474
--- Comment #5 from anlauf at gcc dot gnu.org ---
I am now stuck with the following code, which I believe is valid.
(It is accepted by Crayftn and rejected by Intel, but I thought it is
covered by F2018:5.4.7(5)):
program p
type t
integer :: a(1,2)
end type
class(t), allocatable :: x[:]
print *, ucobound (x%a)
end
The problem I have is that gfc_conv_expr_descriptor invokes walk_coarray,
but the result depends on the rank of the array a in type t.
The comment before walk_coarray states:
/* Convert the last ref of a scalar coarray from an AR_ELEMENT to an
AR_FULL, suitable for the scalarizer. */
However, we should find a way to only extract the "co-descriptor".
We might also need that when implement COSHAPE.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-26 20:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 18:51 [Bug fortran/103474] New: ICE in simplify_cobound, at fortran/simplify.c:4415 gscfq@t-online.de
2021-11-29 20:40 ` [Bug fortran/103474] " kargl at gcc dot gnu.org
2022-01-26 17:24 ` gscfq@t-online.de
2022-10-20 21:01 ` anlauf at gcc dot gnu.org
2022-10-25 19:27 ` anlauf at gcc dot gnu.org
2022-10-26 20:44 ` 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).