[Bug fortran/93832] [8/9/10 Regression] ICE in gfc_convert_to_structure_constructor, at fortran/primary.c:3100
markeggleston at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 4 11:15:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93832
--- Comment #5 from markeggleston at gcc dot gnu.org ---
Created attachment 47968
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47968&action=edit
Incomplete patch
Please find att an incomplete patch.
program p
type t
character :: a
integer :: b
integer :: c(t(1, 2, 3))
end type
end
results in:
5 | integer :: c(t(1, 2, 3))
| 1
Error: Expression at (1) must be of INTEGER type, found DERIVED
pr93832_2.f03:7:19:
5 | integer :: c(t(1, 2, 3))
| 1
Error: Cannot convert INTEGER(4) to CHARACTER(1) at (1)
instead of an ICE
However the following:
program p
type t
character :: a
integer :: b
integer :: c(t())
end type
end
results in
5 | integer :: c(t())
| 1
Error: No initializer for component 'a' given in the structure constructor at
(1)
I had hoped to report "Error: Expression at (1) must be of INTEGER type, found
DERIVED", the closest I managed was "Error: Expression at (1) must be of
INTEGER type, found UNKNOWN". Unfortunately that also resulted in duplicate and
spurious error messages.
As it stands the patch has the following side affect when running check-fortran
FAIL: gfortran.dg/typebound_call_25.f90 -O (internal compiler error)
FAIL: gfortran.dg/typebound_call_25.f90 -O (test for errors, line 32)
FAIL: gfortran.dg/typebound_call_25.f90 -O (test for errors, line 33)
FAIL: gfortran.dg/typebound_call_25.f90 -O (test for excess errors)
FAIL: gfortran.dg/typebound_proc_31.f90 -O (internal compiler error)
FAIL: gfortran.dg/typebound_proc_31.f90 -O (test for excess errors)
FAIL: gfortran.dg/typebound_proc_32.f90 -O (internal compiler error)
FAIL: gfortran.dg/typebound_proc_32.f90 -O (test for excess errors)
typebound_proc_31.f90:
! { dg-do compile }
!
! PR 59450: [OOP] ICE for type-bound-procedure expression in module procedure
interface
!
! Contributed by <bugs@miller-mohr.de>
module classes
implicit none
type :: base_class
contains
procedure, nopass :: get_num
end type
contains
pure integer function get_num()
end function
function get_array( this ) result(array)
class(base_class), intent(in) :: this
integer, dimension( this%get_num() ) :: array
end function
end module
produces this ICE:
f951: internal compiler error: check_restricted(): Unknown expression type
0x6c6ede gfc_report_diagnostic
../../gcc/gcc/fortran/error.c:782
0x6c85ca gfc_internal_error(char const*, ...)
../../gcc/gcc/fortran/error.c:1402
0x6cb6db check_restricted
../../gcc/gcc/fortran/expr.c:3428
0x6964b4 resolve_array_bound
../../gcc/gcc/fortran/array.c:378
0x697180 gfc_resolve_array_spec(gfc_array_spec*, int)
../../gcc/gcc/fortran/array.c:424
0x7406fe resolve_symbol
../../gcc/gcc/fortran/resolve.c:15832
0x7400c1 resolve_symbol
../../gcc/gcc/fortran/resolve.c:15247
0x75c6ab do_traverse_symtree
../../gcc/gcc/fortran/symbol.c:4147
0x742ccc resolve_types
../../gcc/gcc/fortran/resolve.c:17121
0x73e4dc gfc_resolve(gfc_namespace*)
../../gcc/gcc/fortran/resolve.c:17236
0x726aa4 gfc_parse_file()
../../gcc/gcc/fortran/parse.c:6447
0x77206f gfc_be_parse_file
../../gcc/gcc/fortran/f95-lang.c:210
Please submit a full bug report,
patch applied to master at f1a681a174cdfb82e62c246d6f4add9a25fc2e43
At this point I'm stuck and I currently don't have the knowledge to fix this.
More information about the Gcc-bugs
mailing list