There are 2 issues:
- Bug 46789 : Expected compile time error is not coming for Select type specification. Compile time error should be generated if Selector is NOT unlimited Polymorphic and Intrinsic type specification is specified in Type Guard statement.
- Bug 46830 : Semantic error is not coming for duplicate intrinsic type specification in type guard statement.
Bug 46789 : As per below Fortran 2018 specification, compile time error should be generated if Selector is NOT unlimited Polymorphic and Intrinsic type specification is specified in Type Guard statement.
C1162 (R1152) If selector is not unlimited polymorphic, each TYPE IS or CLASS IS type-guard-stmt shall specify an extension of the declared type of selector.
Test program: Error is expected at line #16 as selector is NOT class(*).
[root@localhost Select_type_fix]# cat -n selecttype04.f90
1 type base 2 integer :: ii 3 end type 4 type,extends(base) :: ext 5 integer :: jj 6 end type 7 call CheckC1162() 8 contains 9 subroutine CheckC1162() 10 class(base),allocatable :: aobj 11 allocate(ext::aobj) 12 select type(sel=>aobj) 13 ! OK 14 class is(base) 15 !ERROR: Intrinsic Type specification must not be specified 16 type is(integer) 17 ! OK 18 class default 19 end select 20 end 21 end
- Gfortran behavior is correct, expected compilation Error is coming.
[root@localhost Select_type_fix]# gfortran selecttype04.f90
selecttype04.f90:16:12:
type is(integer) 1
Error: Unexpected intrinsic type ‘INTEGER’ at (1)
Can you please use GetGuardFromStmt here?