public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
@ 2022-06-02 3:56 asolokha at gmx dot com
2022-06-02 14:48 ` [Bug fortran/105813] " kargl at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: asolokha at gmx dot com @ 2022-06-02 3:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
Bug ID: 105813
Summary: ICE in gfc_simplify_unpack, at
fortran/simplify.cc:8490
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
Target Milestone: ---
gfortran 13.0.0 20220529 snapshot (g:58a40e76ebadce78639644cd3d56e42b68336927)
ICEs when compiling the following testcase, extracted from
flang/test/Evaluate/errors01.f90 from the flang 14.0.3 test suite:
module m
contains
subroutine s5
logical, parameter :: mask(2,3) = reshape([.false., .true., .true.,
.false., .false., .true.], shape(mask))
integer, parameter :: field(3,2) = reshape([(-j,j=1,6)], shape(field))
integer :: x(2,3)
x = unpack([1,2], mask, 0)
end subroutine
end module
% powerpc-e300c3-linux-gnu-gfortran-13.0.0 -c q7sa2auy.f90
f951: internal compiler error: in gfc_simplify_unpack, at
fortran/simplify.cc:8490
0x5cf7d8 gfc_simplify_unpack(gfc_expr*, gfc_expr*, gfc_expr*)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/simplify.cc:8490
0x831714 do_simplify
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/intrinsic.cc:4677
0x83d443 gfc_intrinsic_func_interface(gfc_expr*, int)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/intrinsic.cc:5056
0x8a37b6 resolve_unknown_f
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/resolve.cc:2990
0x8a37b6 resolve_function
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/resolve.cc:3347
0x8a37b6 gfc_resolve_expr(gfc_expr*)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/resolve.cc:7187
0x8ab84e gfc_resolve_expr(gfc_expr*)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/resolve.cc:7154
0x8ab84e gfc_resolve_code(gfc_code*, gfc_namespace*)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/resolve.cc:11970
0x8aec17 resolve_codes
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/resolve.cc:17609
0x8aeb4e resolve_codes
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/resolve.cc:17592
0x8aecee gfc_resolve(gfc_namespace*)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/resolve.cc:17644
0x88de79 gfc_parse_file()
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/parse.cc:6810
0x8e273f gfc_be_parse_file
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/fortran/f95-lang.cc:218
(While the target here is powerpc, the ICE is not target-specific.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
@ 2022-06-02 14:48 ` kargl at gcc dot gnu.org
2022-06-23 21:18 ` anlauf at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-06-02 14:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-06-02
Ever confirmed|0 |1
Priority|P3 |P4
CC| |kargl at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from kargl at gcc dot gnu.org ---
Instead of an ICE on a user's invalid code, issue an actual error message.
diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc
index 233cc42137f..a962de2249a 100644
--- a/gcc/fortran/simplify.cc
+++ b/gcc/fortran/simplify.cc
@@ -8478,16 +8460,22 @@ gfc_simplify_unpack (gfc_expr *vector, gfc_expr *mask,
gfc_expr *field)
vector_ctor = gfc_constructor_first (vector->value.constructor);
mask_ctor = gfc_constructor_first (mask->value.constructor);
- field_ctor
- = field->expr_type == EXPR_ARRAY
- ? gfc_constructor_first (field->value.constructor)
- : NULL;
+ if (field->expr_type == EXPR_ARRAY)
+ field_ctor = gfc_constructor_first (field->value.constructor);
+ else
+ field_ctor = NULL;
while (mask_ctor)
{
if (mask_ctor->expr->value.logical)
{
- gcc_assert (vector_ctor);
+ if (!vector_ctor)
+ {
+ gfc_error ("Size of vector at %L must be as large as the count "
+ "of .true. values in mask at %L", &vector->where,
+ &mask->where);
+ return NULL;
+ }
e = gfc_copy_expr (vector_ctor->expr);
vector_ctor = gfc_constructor_next (vector_ctor);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
2022-06-02 14:48 ` [Bug fortran/105813] " kargl at gcc dot gnu.org
@ 2022-06-23 21:18 ` anlauf at gcc dot gnu.org
2022-06-23 22:07 ` sgk at troutmask dot apl.washington.edu
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-06-23 21:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
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 ---
Simpler fix:
diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index 0c2cb50c6a7..91d87a1b2c1 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -6353,6 +6353,8 @@ gfc_check_unpack (gfc_expr *vector, gfc_expr *mask,
gfc_expr *field)
if (!same_type_check (vector, 0, field, 2))
return false;
+ gfc_simplify_expr (mask, 0);
+
if (mask->expr_type == EXPR_ARRAY
&& gfc_array_size (vector, &vector_size))
{
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
2022-06-02 14:48 ` [Bug fortran/105813] " kargl at gcc dot gnu.org
2022-06-23 21:18 ` anlauf at gcc dot gnu.org
@ 2022-06-23 22:07 ` sgk at troutmask dot apl.washington.edu
2022-06-24 20:29 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2022-06-23 22:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Jun 23, 2022 at 09:18:40PM +0000, anlauf at gcc dot gnu.org wrote:
>
> --- Comment #2 from anlauf at gcc dot gnu.org ---
> Simpler fix:
>
> diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
> index 0c2cb50c6a7..91d87a1b2c1 100644
> --- a/gcc/fortran/check.cc
> +++ b/gcc/fortran/check.cc
> @@ -6353,6 +6353,8 @@ gfc_check_unpack (gfc_expr *vector, gfc_expr *mask,
> gfc_expr *field)
> if (!same_type_check (vector, 0, field, 2))
> return false;
>
> + gfc_simplify_expr (mask, 0);
> +
> if (mask->expr_type == EXPR_ARRAY
> && gfc_array_size (vector, &vector_size))
> {
>
If it survives regression testing, then I think it
can be committed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
` (2 preceding siblings ...)
2022-06-23 22:07 ` sgk at troutmask dot apl.washington.edu
@ 2022-06-24 20:29 ` cvs-commit at gcc dot gnu.org
2022-06-26 20:30 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-24 20:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
--- 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:f21f17f95c0237f4f987a5fa9f1fa9c7e0db3c40
commit r13-1260-gf21f17f95c0237f4f987a5fa9f1fa9c7e0db3c40
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Jun 24 22:21:39 2022 +0200
Fortran: fix checking of arguments to UNPACK when MASK is a variable
[PR105813]
gcc/fortran/ChangeLog:
PR fortran/105813
* check.cc (gfc_check_unpack): Try to simplify MASK argument to
UNPACK so that checking of the VECTOR argument can work when MASK
is a variable.
gcc/testsuite/ChangeLog:
PR fortran/105813
* gfortran.dg/unpack_vector_1.f90: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
` (3 preceding siblings ...)
2022-06-24 20:29 ` cvs-commit at gcc dot gnu.org
@ 2022-06-26 20:30 ` anlauf at gcc dot gnu.org
2022-06-30 20:02 ` 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 @ 2022-06-26 20:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
--- Comment #5 from anlauf at gcc dot gnu.org ---
Should have taken it...
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
` (4 preceding siblings ...)
2022-06-26 20:30 ` anlauf at gcc dot gnu.org
@ 2022-06-30 20:02 ` cvs-commit at gcc dot gnu.org
2022-07-01 17:10 ` 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 @ 2022-06-30 20:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:eb4336f546b2a770717af608c79b4d46f45ef7c2
commit r12-8529-geb4336f546b2a770717af608c79b4d46f45ef7c2
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Jun 24 22:21:39 2022 +0200
Fortran: fix checking of arguments to UNPACK when MASK is a variable
[PR105813]
gcc/fortran/ChangeLog:
PR fortran/105813
* check.cc (gfc_check_unpack): Try to simplify MASK argument to
UNPACK so that checking of the VECTOR argument can work when MASK
is a variable.
gcc/testsuite/ChangeLog:
PR fortran/105813
* gfortran.dg/unpack_vector_1.f90: New test.
(cherry picked from commit f21f17f95c0237f4f987a5fa9f1fa9c7e0db3c40)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
` (5 preceding siblings ...)
2022-06-30 20:02 ` cvs-commit at gcc dot gnu.org
@ 2022-07-01 17:10 ` cvs-commit at gcc dot gnu.org
2022-07-01 17:24 ` cvs-commit at gcc dot gnu.org
2022-07-01 17:26 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-01 17:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
--- 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:9902f93edd43853cd958b2e124878865da69a177
commit r11-10101-g9902f93edd43853cd958b2e124878865da69a177
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Jun 24 22:21:39 2022 +0200
Fortran: fix checking of arguments to UNPACK when MASK is a variable
[PR105813]
gcc/fortran/ChangeLog:
PR fortran/105813
* check.c (gfc_check_unpack): Try to simplify MASK argument to
UNPACK so that checking of the VECTOR argument can work when MASK
is a variable.
gcc/testsuite/ChangeLog:
PR fortran/105813
* gfortran.dg/unpack_vector_1.f90: New test.
(cherry picked from commit f21f17f95c0237f4f987a5fa9f1fa9c7e0db3c40)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
` (6 preceding siblings ...)
2022-07-01 17:10 ` cvs-commit at gcc dot gnu.org
@ 2022-07-01 17:24 ` cvs-commit at gcc dot gnu.org
2022-07-01 17:26 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-01 17:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
--- 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:1214ebb39cd250fda678ec89c785fcea86888a89
commit r10-10876-g1214ebb39cd250fda678ec89c785fcea86888a89
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Jun 24 22:21:39 2022 +0200
Fortran: fix checking of arguments to UNPACK when MASK is a variable
[PR105813]
gcc/fortran/ChangeLog:
PR fortran/105813
* check.c (gfc_check_unpack): Try to simplify MASK argument to
UNPACK so that checking of the VECTOR argument can work when MASK
is a variable.
gcc/testsuite/ChangeLog:
PR fortran/105813
* gfortran.dg/unpack_vector_1.f90: New test.
(cherry picked from commit f21f17f95c0237f4f987a5fa9f1fa9c7e0db3c40)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/105813] ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
` (7 preceding siblings ...)
2022-07-01 17:24 ` cvs-commit at gcc dot gnu.org
@ 2022-07-01 17:26 ` anlauf at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-01 17:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |10.5
--- Comment #9 from anlauf at gcc dot gnu.org ---
Fixed for all open branches. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-07-01 17:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 3:56 [Bug fortran/105813] New: ICE in gfc_simplify_unpack, at fortran/simplify.cc:8490 asolokha at gmx dot com
2022-06-02 14:48 ` [Bug fortran/105813] " kargl at gcc dot gnu.org
2022-06-23 21:18 ` anlauf at gcc dot gnu.org
2022-06-23 22:07 ` sgk at troutmask dot apl.washington.edu
2022-06-24 20:29 ` cvs-commit at gcc dot gnu.org
2022-06-26 20:30 ` anlauf at gcc dot gnu.org
2022-06-30 20:02 ` cvs-commit at gcc dot gnu.org
2022-07-01 17:10 ` cvs-commit at gcc dot gnu.org
2022-07-01 17:24 ` cvs-commit at gcc dot gnu.org
2022-07-01 17:26 ` 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).