flang
flang copied to clipboard
F08: Internal compiler error on code using initialization by default constructors
Error message:
Lowering Error: unknown source type for conversion to integer*8 [ast=13,asttype=1,datatype=0]
F90-F-0000-Internal compiler error. Errors in Lowering 1 (test.f90: 16)
F90/x86-64 Linux Flang - 1.5 2017-05-01: compilation aborted
Code:
program test
type :: First
end type First
type :: Second
class(First), allocatable :: obj
end type Second
class(First), allocatable :: obj1
class(Second), allocatable :: obj2
obj1 = First()
obj2 = Second(obj1)
end program test
I guess the root cause of this issue is miss determining the type. This leads to evaluating if expression in lowerexp.c line 1227 as false and falling into conversion switch-case.
Below code doesn't reproduce this issue:
program test
type :: First
integer :: i
end type First
type :: Second
class(First), allocatable :: obj
end type Second
class(First), allocatable :: obj1
class(Second), allocatable :: obj2
obj1 = First(1)
obj2 = Second(obj1)
end program test