[PATCH] D89581: [flang] Disallow pointer constants
Pete Steinfeld via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 16 11:50:56 PDT 2020
PeteSteinfeld created this revision.
PeteSteinfeld added reviewers: klausler, tskeith.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
PeteSteinfeld requested review of this revision.
None of the other Fortran compilers allow them.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89581
Files:
flang/lib/Semantics/check-declarations.cpp
flang/test/Semantics/resolve90.f90
Index: flang/test/Semantics/resolve90.f90
===================================================================
--- flang/test/Semantics/resolve90.f90
+++ flang/test/Semantics/resolve90.f90
@@ -1,10 +1,13 @@
! RUN: %S/test_errors.sh %s %t %f18
+! Testing for pointer constant, along with :
! C751 A component shall not have both the ALLOCATABLE and POINTER attributes.
! C752 If the CONTIGUOUS attribute is specified, the component shall be an
! array with the POINTER attribute.
! C753 The * char-length option is permitted only if the component is of type
! character.
subroutine s()
+ !ERROR: 'nullint' may not have both the POINTER and PARAMETER attributes
+ integer, pointer, parameter :: nullint => null()
type derivedType
!ERROR: 'pointerallocatablefield' may not have both the POINTER and ALLOCATABLE attributes
real, pointer, allocatable :: pointerAllocatableField
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -1280,6 +1280,7 @@
CheckConflicting(symbol, Attr::POINTER, Attr::TARGET);
CheckConflicting(symbol, Attr::POINTER, Attr::ALLOCATABLE); // C751
CheckConflicting(symbol, Attr::POINTER, Attr::INTRINSIC);
+ CheckConflicting(symbol, Attr::POINTER, Attr::PARAMETER);
if (symbol.Corank() > 0) {
messages_.Say(
"'%s' may not have the POINTER attribute because it is a coarray"_err_en_US,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89581.298703.patch
Type: text/x-patch
Size: 1521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201016/e6eb2498/attachment.bin>
More information about the llvm-commits
mailing list