[flang-commits] [PATCH] D142768: [flang] Portability warnings for an ambiguous ASSOCIATED() case

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jan 27 09:53:28 PST 2023


klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added subscribers: sunshaoce, jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

The standard's specification for the ASSOCIATED() intrinsic function
describes its optional second argument (TARGET=) as being required  
to be a valid target for a pointer assignment statement in which the
first argument (POINTER=) was the left-hand side.  Some Fortran compilers 
apparently interpret this text as a requirement that the POINTER= argument
actually be a valid left-hand side to a pointer assignment statement,
and emit an error if it is not so.  This particularly affects the
use of an explicit NULL pointer as the first argument.

Such usage is well-defined, benign, useful, and supported by at least
two other compilers, so we should continue to accept it.  This patch
adds a portability warning and some documentation.

In order to implement the portability warning in the best way, the 
special checks on calls to the ASSOCIATED() intrinsic function have
been moved from intrinsic processing to Semantics/check-calls.cpp,  
whence they have access to semantics' toolchest.  Special checks for
other intrinsic functions might also migrate in the future in order
to keep them all in one place.


https://reviews.llvm.org/D142768

Files:
  flang/docs/Extensions.md
  flang/include/flang/Evaluate/tools.h
  flang/lib/Evaluate/intrinsics.cpp
  flang/lib/Evaluate/tools.cpp
  flang/lib/Semantics/check-call.cpp
  flang/lib/Semantics/check-call.h
  flang/lib/Semantics/definable.cpp
  flang/lib/Semantics/expression.cpp
  flang/test/Evaluate/folding06.f90
  flang/test/Semantics/associated.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142768.492826.patch
Type: text/x-patch
Size: 27634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230127/aa66801a/attachment-0001.bin>


More information about the flang-commits mailing list