public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/109148] New: ICE with explicit-/assumed-size arrays and CLASS
@ 2023-03-15 19:56 anlauf at gcc dot gnu.org
2023-03-16 9:07 ` [Bug fortran/109148] " marxin at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-03-15 19:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109148
Bug ID: 109148
Summary: ICE with explicit-/assumed-size arrays and CLASS
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
The following is a spin-off from pr58331. Consider:
module mymod
implicit none
type t
integer :: i
end type t
contains
subroutine mysub(a, n)
integer, intent(in) :: n
class(*), intent(in) :: a(n)
select type(a)
type is(integer)
print *,'a is integer'
print *, "n=", n, ' a=', a
class default
print *,'a is unsupported type'
stop 1
end select
end
subroutine sub_t(a, n)
integer, intent(in) :: n
class(t), intent(in) :: a(n)
select type(a)
class is(t)
print *,'a is type(t)'
print *, "n=", n, ' a=', a%i
class default
print *,'a is unsupported type'
stop 1
end select
end
! Unlimited polymorphic variant
subroutine sub_star(a, n)
integer, intent(in) :: n
class(*), intent(in) :: a(n)
select type(a)
type is(integer)
print *,'a is integer'
print *, "n=", n, ' a=', a
class is(t)
print *,'a is type(t)'
print *, "n=", n, ' a=', a%i
class default
print *,'a is unsupported type'
stop 1
end select
end
end
program p
use mymod
implicit none
integer :: b(2,2) = reshape([21, 22, 23, 24], [2,2])
type(t) :: x(2,2) = reshape([t(5), t(6),t(7),t(8)], [2,2])
type(t) :: y(4) = [t(15), t(16),t(17),t(18)]
class(t), allocatable :: w(:)
class(t), allocatable :: z(:,:)
allocate (z, source=x)
allocate (w, source=y)
call mysub (b,4) ! see pr58331
! call sub_t (b,4) ! correctly rejected
call sub_t (y,4)
call sub_t (z,4) ! OK (although wrong code with crayftn 14.0)
call sub_t (w,4) ! OK
call sub_star(b,4) ! ok
call sub_star(y,4) ! ok
! call sub_star(x,4) ! ICE in gfc_conv_derived_to_class
! call sub_t (x,4) ! ICE in gfc_conv_derived_to_class
end
This compiles and seems to work fine with r13-6698. But uncommenting one
of the last two calls produces:
class_dummy_11.f90:76:54:
76 | call sub_star(x,4) ! ICE in gfc_conv_derived_to_class
| 1
internal compiler error: in gfc_conv_derived_to_class, at
fortran/trans-expr.cc:831
0x70cdc0 gfc_conv_derived_to_class(gfc_se*, gfc_expr*, gfc_typespec,
tree_node*, bool, bool, tree_node**)
../../gcc-trunk/gcc/fortran/trans-expr.cc:831
0xa2dcdd gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
../../gcc-trunk/gcc/fortran/trans-expr.cc:6223
0xa81f22 gfc_trans_call(gfc_code*, bool, tree_node*, tree_node*, bool)
../../gcc-trunk/gcc/fortran/trans-stmt.cc:424
0x9ee9d3 trans_code
../../gcc-trunk/gcc/fortran/trans.cc:2018
0xa20eb1 gfc_generate_function_code(gfc_namespace*)
../../gcc-trunk/gcc/fortran/trans-decl.cc:7704
0x99a587 translate_all_program_units
../../gcc-trunk/gcc/fortran/parse.cc:6720
0x99a587 gfc_parse_file()
../../gcc-trunk/gcc/fortran/parse.cc:7026
0x9eb4df gfc_be_parse_file
../../gcc-trunk/gcc/fortran/f95-lang.cc:229
The code seems to work with Nvidia 23.1, works mostly with Crayftn 14.0,
but fails at runtime with Intel 2021.8.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/109148] ICE with explicit-/assumed-size arrays and CLASS
2023-03-15 19:56 [Bug fortran/109148] New: ICE with explicit-/assumed-size arrays and CLASS anlauf at gcc dot gnu.org
@ 2023-03-16 9:07 ` marxin at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-03-16 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109148
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2023-03-16
Status|UNCONFIRMED |NEW
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
It's fixed since r13-6698-g901edd99b44976b3.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-16 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 19:56 [Bug fortran/109148] New: ICE with explicit-/assumed-size arrays and CLASS anlauf at gcc dot gnu.org
2023-03-16 9:07 ` [Bug fortran/109148] " marxin 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).