[flang-commits] [PATCH] D121377: [flang] Do not return true for pointer sub-object in IsPointerObject

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Mar 10 07:25:51 PST 2022


jeanPerier created this revision.
jeanPerier added a reviewer: klausler.
jeanPerier added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.

evaluate::IsPointerObject used to return true for pointer suboject like
`pointer(10)` while these object are not pointers. This prevented some
checks like 15.5.2.7 to be correctly enforced (e.g., it was possible to
pass `pointer(10)` to a non intent(in) dummy pointer).

After updating IsPointerObject behavior and adding a test for 15.5.2.7 in
call07.f90, a test in call03.f90 for 15.5.2.4(14) was failing.
It appeared the related semantics check was relying on IsPointerObject
to return true for `pointer(10)`. Adapt the code to detect pointer element
in another way.
While looking at the code, I also noticed that semantics was
rejecting `character(1)` pointer/assumed shape suboject when these are
allowed (the standard has a special case for character(1) in
15.5.2.4(14), and I verified that other compilers that enforce 15.5.2.4(14)
do accept this).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121377

Files:
  flang/lib/Evaluate/tools.cpp
  flang/lib/Semantics/check-call.cpp
  flang/test/Semantics/call03.f90
  flang/test/Semantics/call07.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121377.414375.patch
Type: text/x-patch
Size: 5655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220310/81732b14/attachment.bin>


More information about the flang-commits mailing list