[PATCH] D84290: [Flang] Fix for the scenario when type guard has intrinsic type specification and Selector is NOT unlimited Polymorphic.

Inderjeet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 06:16:39 PDT 2020


inderjeet-hcl marked an inline comment as done.
inderjeet-hcl added a comment.

@sameeranjoshi , Kindly refer comment inline.



================
Comment at: flang/lib/Semantics/check-select-type.cpp:100
                       *derived, parser::FindSourceLocation(typeSpec));
                 }
                 return false;
----------------
sameeranjoshi wrote:
> inderjeet-hcl wrote:
> > sameeranjoshi wrote:
> > > How about adding an `else if ` statement here?
> > > ```
> > > if (){
> > > ...
> > > } else if (!selectorType_.IsUnlimitedPolymorphic() && spec->AsIntrinsic()) {  // C1162
> > >   ...
> > > }
> > > ```
> > I think either way is fine. I added 'if' condition at the beginning considering  if type specification is of intrinsic type then that should be the first check to be performed.
> I think adding at beginning would never check `C1160`.
I agree, If added at the begging and selector is not uninlimited polymorphic then C1160 will not be checked and return will execute after generating NEW error message for C1162.

However, adding "elseif" will never generate new error if C1160 is generated. Kindly refer below case.
One solution might be to change code and add if condition for 'Intrinsic type' and perform error checks for C1160 and C1162 before returning false. 
Kindly suggest, if I should modify source code. 

[root at localhost Github_compiler]# ./f18 selecttype.f90 
error: The type specification statement must have LEN type parameter as assumed
./f18: semantic errors in selecttype.f90
[root at localhost Github_compiler]# cat -n selecttype.f90 
     1	type ty
     2	 integer :: ii
     3	end type
     4	class(ty),allocatable :: cptr
     5	
     6	select type(cptr)
     7	 !ERROR: The type specification statement must have LEN type parameter as assumed
     8	 type is(character) !<-- assumed length-type
     9	end select
    10	end




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84290/new/

https://reviews.llvm.org/D84290





More information about the llvm-commits mailing list