[flang] Fix LBOUND rewrite on descriptor components
GetLowerBoundHelper rewrite in https://reviews.llvm.org/D121488 was incorrect with POINTER/ALLOCATABLE components. The rewrite created a descriptor inquiry to the component symbol only instead of the whole named entity. The base information was lost, and not retrievable. LBOUND(a(10)%p) became LBOUND(p). Fix this regression, and also update DescriptorInquiry unparsing to carry the kind information. DescriptorInquiries are KIND 8 expressions, while LBOUND/SIZE/RANK, %LEN are default kind expressions. This caused `print *,lbound(x,kind=8)` to unparse as `print*,lbound(x)` which is not semantically the same (this unparsing issue was not an issue for lowering, but I noticed it while writing my regression test). Differential Revision: https://reviews.llvm.org/D122406
Loading
Please sign in to comment