[Patch, fortran] PR83118 - [8/9/10/11 Regression] Bad intrinsic assignment of class(*) array component of derived type

Paul Richard Thomas paul.richard.thomas@gmail.com
Wed Nov 11 17:11:35 GMT 2020


Hi Dominique,

Many thanks for these failing testcases.

If I remove the assertion at trans-array.c:1304 (part of the patch) the
first testcase compiles and runs but is producing wrong code. Clearly the
extraction of the class information in the new function
'get_class_info_from_ss' is incomplete because the class wrapper itself is
used as the element type for the temporary array, when the allocation of
'c' is used. On the other hand, the assignment works fine.

The second testcase fails because 't2' is never referenced in any statement
where a check is made for its vtable.

I have generated a third testcase, where a dependency generates wrong code
and wrong results.

I will retire the patch to fix these problems. I would like both class
assignment and allocation with source to give both correct code and correct
results!

Regards

Paul


On Wed, 11 Nov 2020 at 16:42, <dhumieres.dominique@free.fr> wrote:

> Hi Paul,
>
> I am absolutely unable to review the patch, but I can apply it and test
> it.
>
> I have found several regressions giving the following ICE
>
> internal compiler error: in gfc_trans_create_temp_array, at
> fortran/trans-array.c:1304
>
> For instance (pr51864)
>
> type t
>    integer :: i = 5
> end type t
> type, extends(t) :: t2
>    integer :: j = 6
> end type t2
>
> class(t), allocatable :: a(:), b(:), c(:)
> allocate(t2 :: a(3))
> allocate(t2 :: b(5))
> !allocate(c, source=[ a, b ]) ! F2008, PR 44672
> allocate(c(8), source=[ a, b ])
> ! c = [ a, b ] ! F2008, PR 43366
> select type(c)
>    type is(t)
>      print '(8(i2))', c%i
>    type is(t2)
>      print '(8(i2))', c%i
>      print '(8(i2))', c%j
> end select
> end
>
> I also see
>
> % gfc realloc_3.f90
> Undefined symbols for architecture x86_64:
>    "___copy_MAIN___T2.2", referenced from:
>        ___vtab_MAIN___T2.5 in ccUFYzUc.o
> ld: symbol(s) not found for architecture x86_64
> collect2: error: ld returned 1 exit status
>
> for
>
> type t
>    integer :: x
> end type t
> type, extends(t) :: t2
>    integer :: j(4)
> end type t2
> class(t), allocatable :: y(:)
> y = [ t2(x=3,j=[1,2,3,4]) ]
> end
>
> The patch also seems to fix pr96012.
>
> Cheers,
>
> Dominique
>


-- 
"If you can't explain it simply, you don't understand it well enough" -
Albert Einstein


More information about the Fortran mailing list