Found when working on PR102689 Expected: * 'CLASS(t)' in the first error message * an error for passing CLASS(t) to TYPE(t2) in the call with RESHAPE. implicit none (type, external) type t end type t type, extends(t) :: t2 integer :: i end type t2 class(t), allocatable :: A(:), B(:,:,:) allocate (t2 :: A(100), B(10,10,1)) call bar(A) ! Rejected (with slightly odd message: Error: Type mismatch in argument ‘x’ at (1); passed CLASS(__class_MAIN___T_1_0a) to TYPE(t2) call bar(reshape(B, [size(B)])) ! Wrongly accepted contains subroutine bar(x) type(t2), intent(in) :: x(:) end end
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>: https://gcc.gnu.org/g:017665f63047ce47b087b0b283548a60e5abf3d2 commit r12-4464-g017665f63047ce47b087b0b283548a60e5abf3d2 Author: Tobias Burnus <tobias@codesourcery.com> Date: Mon Oct 18 09:49:05 2021 +0200 Fortran: Fix CLASS conversion check [PR102745] PR fortran/102745 gcc/fortran/ChangeLog * intrinsic.c (gfc_convert_type_warn): Fix checks by checking CLASS and do typcheck in correct order for type extension. * misc.c (gfc_typename): Print proper not internal CLASS type name. gcc/testsuite/ChangeLog * gfortran.dg/class_72.f90: New.
The releases/gcc-11 branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>: https://gcc.gnu.org/g:3de82c6c36fea8fad7145b62ccb3a7c06d1f3c51 commit r11-9173-g3de82c6c36fea8fad7145b62ccb3a7c06d1f3c51 Author: Tobias Burnus <tobias@codesourcery.com> Date: Mon Oct 18 09:49:05 2021 +0200 Fortran: Fix CLASS conversion check [PR102745] PR fortran/102745 gcc/fortran/ChangeLog * intrinsic.c (gfc_convert_type_warn): Fix checks by checking CLASS and do typcheck in correct order for type extension. * misc.c (gfc_typename): Print proper not internal CLASS type name. gcc/testsuite/ChangeLog * gfortran.dg/class_72.f90: New. (cherry picked from commit 017665f63047ce47b087b0b283548a60e5abf3d2)
FIXED (for GCC 11 + 12).