2020-02-25 23:11:52 +08:00
|
|
|
//===-- lib/Evaluate/intrinsics.cpp ---------------------------------------===//
|
2018-09-29 08:02:11 +08:00
|
|
|
//
|
2019-12-21 04:52:07 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2018-09-29 08:02:11 +08:00
|
|
|
//
|
2020-01-11 04:12:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2020-02-25 23:11:52 +08:00
|
|
|
#include "flang/Evaluate/intrinsics.h"
|
|
|
|
#include "flang/Common/Fortran.h"
|
|
|
|
#include "flang/Common/enum-set.h"
|
|
|
|
#include "flang/Common/idioms.h"
|
|
|
|
#include "flang/Evaluate/common.h"
|
|
|
|
#include "flang/Evaluate/expression.h"
|
|
|
|
#include "flang/Evaluate/fold.h"
|
|
|
|
#include "flang/Evaluate/shape.h"
|
|
|
|
#include "flang/Evaluate/tools.h"
|
|
|
|
#include "flang/Evaluate/type.h"
|
2020-02-28 23:11:03 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2018-10-19 01:50:55 +08:00
|
|
|
#include <algorithm>
|
2018-10-05 04:43:33 +08:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2018-10-06 02:32:54 +08:00
|
|
|
using namespace Fortran::parser::literals;
|
|
|
|
|
2018-09-29 08:02:11 +08:00
|
|
|
namespace Fortran::evaluate {
|
|
|
|
|
2019-04-19 05:11:15 +08:00
|
|
|
class FoldingContext;
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// This file defines the supported intrinsic procedures and implements
|
|
|
|
// their recognition and validation. It is largely table-driven. See
|
2020-08-18 17:35:51 +08:00
|
|
|
// docs/intrinsics.md and section 16 of the Fortran 2018 standard
|
2018-10-05 04:43:33 +08:00
|
|
|
// for full details on each of the intrinsics. Be advised, they have
|
|
|
|
// complicated details, and the design of these tables has to accommodate
|
|
|
|
// that complexity.
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// Dummy arguments to generic intrinsic procedures are each specified by
|
|
|
|
// their keyword name (rarely used, but always defined), allowable type
|
2018-10-06 02:32:54 +08:00
|
|
|
// categories, a kind pattern, a rank pattern, and information about
|
|
|
|
// optionality and defaults. The kind and rank patterns are represented
|
|
|
|
// here with code values that are significant to the matching/validation engine.
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2020-03-14 03:19:44 +08:00
|
|
|
// An actual argument to an intrinsic procedure may be a procedure itself
|
|
|
|
// only if the dummy argument is Rank::reduceOperation,
|
|
|
|
// KindCode::addressable, or the special case of NULL(MOLD=procedurePointer).
|
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// These are small bit-sets of type category enumerators.
|
|
|
|
// Note that typeless (BOZ literal) values don't have a distinct type category.
|
|
|
|
// These typeless arguments are represented in the tables as if they were
|
|
|
|
// INTEGER with a special "typeless" kind code. Arguments of intrinsic types
|
2019-05-04 02:29:15 +08:00
|
|
|
// that can also be typeless values are encoded with an "elementalOrBOZ"
|
2018-10-06 02:32:54 +08:00
|
|
|
// rank pattern.
|
2019-04-19 05:11:15 +08:00
|
|
|
// Assumed-type (TYPE(*)) dummy arguments can be forwarded along to some
|
2019-08-13 01:56:18 +08:00
|
|
|
// intrinsic functions that accept AnyType + Rank::anyOrAssumedRank or
|
|
|
|
// AnyType + Kind::addressable.
|
2018-10-05 04:43:33 +08:00
|
|
|
using CategorySet = common::EnumSet<TypeCategory, 8>;
|
2018-10-16 03:17:30 +08:00
|
|
|
static constexpr CategorySet IntType{TypeCategory::Integer};
|
|
|
|
static constexpr CategorySet RealType{TypeCategory::Real};
|
|
|
|
static constexpr CategorySet ComplexType{TypeCategory::Complex};
|
|
|
|
static constexpr CategorySet CharType{TypeCategory::Character};
|
|
|
|
static constexpr CategorySet LogicalType{TypeCategory::Logical};
|
|
|
|
static constexpr CategorySet IntOrRealType{IntType | RealType};
|
|
|
|
static constexpr CategorySet FloatingType{RealType | ComplexType};
|
|
|
|
static constexpr CategorySet NumericType{IntType | RealType | ComplexType};
|
|
|
|
static constexpr CategorySet RelatableType{IntType | RealType | CharType};
|
2019-09-17 07:58:13 +08:00
|
|
|
static constexpr CategorySet DerivedType{TypeCategory::Derived};
|
2018-10-05 04:43:33 +08:00
|
|
|
static constexpr CategorySet IntrinsicType{
|
2018-10-16 03:17:30 +08:00
|
|
|
IntType | RealType | ComplexType | CharType | LogicalType};
|
2019-09-17 07:58:13 +08:00
|
|
|
static constexpr CategorySet AnyType{IntrinsicType | DerivedType};
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2018-10-13 07:01:55 +08:00
|
|
|
ENUM_CLASS(KindCode, none, defaultIntegerKind,
|
2020-03-29 12:00:16 +08:00
|
|
|
defaultRealKind, // is also the default COMPLEX kind
|
2018-10-13 07:01:55 +08:00
|
|
|
doublePrecision, defaultCharKind, defaultLogicalKind,
|
2020-03-29 12:00:16 +08:00
|
|
|
any, // matches any kind value; each instance is independent
|
|
|
|
same, // match any kind, but all "same" kinds must be equal
|
|
|
|
operand, // match any kind, with promotion (non-standard)
|
|
|
|
typeless, // BOZ literals are INTEGER with this kind
|
|
|
|
teamType, // TEAM_TYPE from module ISO_FORTRAN_ENV (for coarrays)
|
|
|
|
kindArg, // this argument is KIND=
|
|
|
|
effectiveKind, // for function results: "kindArg" value, possibly defaulted
|
|
|
|
dimArg, // this argument is DIM=
|
|
|
|
likeMultiply, // for DOT_PRODUCT and MATMUL
|
|
|
|
subscript, // address-sized integer
|
|
|
|
size, // default KIND= for SIZE(), UBOUND, &c.
|
|
|
|
addressable, // for PRESENT(), &c.; anything (incl. procedure) but BOZ
|
2020-09-26 00:03:17 +08:00
|
|
|
nullPointerType, // for ASSOCIATED(NULL())
|
2018-10-13 07:01:55 +08:00
|
|
|
)
|
2018-09-29 08:02:11 +08:00
|
|
|
|
|
|
|
struct TypePattern {
|
|
|
|
CategorySet categorySet;
|
2018-10-02 02:27:45 +08:00
|
|
|
KindCode kindCode{KindCode::none};
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &Dump(llvm::raw_ostream &) const;
|
2018-09-29 08:02:11 +08:00
|
|
|
};
|
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// Abbreviations for argument and result patterns in the intrinsic prototypes:
|
|
|
|
|
|
|
|
// Match specific kinds of intrinsic types
|
2018-10-17 05:42:22 +08:00
|
|
|
static constexpr TypePattern DefaultInt{IntType, KindCode::defaultIntegerKind};
|
|
|
|
static constexpr TypePattern DefaultReal{RealType, KindCode::defaultRealKind};
|
|
|
|
static constexpr TypePattern DefaultComplex{
|
|
|
|
ComplexType, KindCode::defaultRealKind};
|
|
|
|
static constexpr TypePattern DefaultChar{CharType, KindCode::defaultCharKind};
|
|
|
|
static constexpr TypePattern DefaultLogical{
|
2018-10-16 03:17:30 +08:00
|
|
|
LogicalType, KindCode::defaultLogicalKind};
|
|
|
|
static constexpr TypePattern BOZ{IntType, KindCode::typeless};
|
|
|
|
static constexpr TypePattern TEAM_TYPE{IntType, KindCode::teamType};
|
|
|
|
static constexpr TypePattern DoublePrecision{
|
|
|
|
RealType, KindCode::doublePrecision};
|
2019-06-22 05:04:40 +08:00
|
|
|
static constexpr TypePattern DoublePrecisionComplex{
|
|
|
|
ComplexType, KindCode::doublePrecision};
|
2019-07-02 04:22:22 +08:00
|
|
|
static constexpr TypePattern SubscriptInt{IntType, KindCode::subscript};
|
2018-10-05 04:43:33 +08:00
|
|
|
|
|
|
|
// Match any kind of some intrinsic or derived types
|
2018-10-16 03:17:30 +08:00
|
|
|
static constexpr TypePattern AnyInt{IntType, KindCode::any};
|
|
|
|
static constexpr TypePattern AnyReal{RealType, KindCode::any};
|
|
|
|
static constexpr TypePattern AnyIntOrReal{IntOrRealType, KindCode::any};
|
|
|
|
static constexpr TypePattern AnyComplex{ComplexType, KindCode::any};
|
2019-05-30 06:38:33 +08:00
|
|
|
static constexpr TypePattern AnyFloating{FloatingType, KindCode::any};
|
2018-10-16 03:17:30 +08:00
|
|
|
static constexpr TypePattern AnyNumeric{NumericType, KindCode::any};
|
|
|
|
static constexpr TypePattern AnyChar{CharType, KindCode::any};
|
|
|
|
static constexpr TypePattern AnyLogical{LogicalType, KindCode::any};
|
|
|
|
static constexpr TypePattern AnyRelatable{RelatableType, KindCode::any};
|
2018-12-05 02:55:32 +08:00
|
|
|
static constexpr TypePattern AnyIntrinsic{IntrinsicType, KindCode::any};
|
2019-09-17 07:58:13 +08:00
|
|
|
static constexpr TypePattern ExtensibleDerived{DerivedType, KindCode::any};
|
|
|
|
static constexpr TypePattern AnyData{AnyType, KindCode::any};
|
2018-10-05 04:43:33 +08:00
|
|
|
|
2019-08-13 01:56:18 +08:00
|
|
|
// Type is irrelevant, but not BOZ (for PRESENT(), OPTIONAL(), &c.)
|
|
|
|
static constexpr TypePattern Addressable{AnyType, KindCode::addressable};
|
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// Match some kind of some intrinsic type(s); all "Same" values must match,
|
|
|
|
// even when not in the same category (e.g., SameComplex and SameReal).
|
|
|
|
// Can be used to specify a result so long as at least one argument is
|
|
|
|
// a "Same".
|
2018-10-16 03:17:30 +08:00
|
|
|
static constexpr TypePattern SameInt{IntType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameReal{RealType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameIntOrReal{IntOrRealType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameComplex{ComplexType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameFloating{FloatingType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameNumeric{NumericType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameChar{CharType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameLogical{LogicalType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameRelatable{RelatableType, KindCode::same};
|
2018-10-05 04:43:33 +08:00
|
|
|
static constexpr TypePattern SameIntrinsic{IntrinsicType, KindCode::same};
|
|
|
|
static constexpr TypePattern SameDerivedType{
|
|
|
|
CategorySet{TypeCategory::Derived}, KindCode::same};
|
|
|
|
static constexpr TypePattern SameType{AnyType, KindCode::same};
|
|
|
|
|
2019-07-18 03:51:52 +08:00
|
|
|
// Match some kind of some INTEGER or REAL type(s); when argument types
|
|
|
|
// &/or kinds differ, their values are converted as if they were operands to
|
|
|
|
// an intrinsic operation like addition. This is a nonstandard but nearly
|
|
|
|
// universal extension feature.
|
|
|
|
static constexpr TypePattern OperandReal{RealType, KindCode::operand};
|
|
|
|
static constexpr TypePattern OperandIntOrReal{IntOrRealType, KindCode::operand};
|
|
|
|
|
2020-09-26 00:03:17 +08:00
|
|
|
// For ASSOCIATED, the first argument is a typeless pointer
|
|
|
|
static constexpr TypePattern AnyPointer{AnyType, KindCode::nullPointerType};
|
|
|
|
|
2018-10-10 03:07:29 +08:00
|
|
|
// For DOT_PRODUCT and MATMUL, the result type depends on the arguments
|
2018-10-16 03:17:30 +08:00
|
|
|
static constexpr TypePattern ResultLogical{LogicalType, KindCode::likeMultiply};
|
|
|
|
static constexpr TypePattern ResultNumeric{NumericType, KindCode::likeMultiply};
|
2018-10-10 03:07:29 +08:00
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// Result types with known category and KIND=
|
2018-10-16 03:17:30 +08:00
|
|
|
static constexpr TypePattern KINDInt{IntType, KindCode::effectiveKind};
|
|
|
|
static constexpr TypePattern KINDReal{RealType, KindCode::effectiveKind};
|
|
|
|
static constexpr TypePattern KINDComplex{ComplexType, KindCode::effectiveKind};
|
|
|
|
static constexpr TypePattern KINDChar{CharType, KindCode::effectiveKind};
|
|
|
|
static constexpr TypePattern KINDLogical{LogicalType, KindCode::effectiveKind};
|
2018-09-29 08:02:11 +08:00
|
|
|
|
|
|
|
// The default rank pattern for dummy arguments and function results is
|
|
|
|
// "elemental".
|
2018-10-13 07:01:55 +08:00
|
|
|
ENUM_CLASS(Rank,
|
2020-03-29 12:00:16 +08:00
|
|
|
elemental, // scalar, or array that conforms with other array arguments
|
|
|
|
elementalOrBOZ, // elemental, or typeless BOZ literal scalar
|
2018-10-13 07:01:55 +08:00
|
|
|
scalar, vector,
|
2020-03-29 12:00:16 +08:00
|
|
|
shape, // INTEGER vector of known length and no negative element
|
2018-10-13 07:01:55 +08:00
|
|
|
matrix,
|
2020-03-29 12:00:16 +08:00
|
|
|
array, // not scalar, rank is known and greater than zero
|
|
|
|
known, // rank is known and can be scalar
|
|
|
|
anyOrAssumedRank, // rank can be unknown; assumed-type TYPE(*) allowed
|
|
|
|
conformable, // scalar, or array of same rank & shape as "array" argument
|
|
|
|
reduceOperation, // a pure function with constraints for REDUCE
|
|
|
|
dimReduced, // scalar if no DIM= argument, else rank(array)-1
|
2021-01-15 04:54:31 +08:00
|
|
|
dimRemovedOrScalar, // rank(array)-1 (less DIM) or scalar
|
|
|
|
locReduced, // vector(1:rank) if no DIM= argument, else rank(array)-1
|
2020-03-29 12:00:16 +08:00
|
|
|
rankPlus1, // rank(known)+1
|
|
|
|
shaped, // rank is length of SHAPE vector
|
2018-10-13 07:01:55 +08:00
|
|
|
)
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2021-01-15 04:54:31 +08:00
|
|
|
ENUM_CLASS(Optionality, required, optional, missing,
|
2020-03-29 12:00:16 +08:00
|
|
|
defaultsToSameKind, // for MatchingDefaultKIND
|
|
|
|
defaultsToDefaultForResult, // for DefaultingKIND
|
|
|
|
defaultsToSizeKind, // for SizeDefaultKIND
|
|
|
|
repeats, // for MAX/MIN and their several variants
|
2018-10-13 07:01:55 +08:00
|
|
|
)
|
2018-09-29 08:02:11 +08:00
|
|
|
|
|
|
|
struct IntrinsicDummyArgument {
|
2018-10-02 02:27:45 +08:00
|
|
|
const char *keyword{nullptr};
|
2018-09-29 08:02:11 +08:00
|
|
|
TypePattern typePattern;
|
2018-10-05 04:43:33 +08:00
|
|
|
Rank rank{Rank::elemental};
|
2018-10-06 02:32:54 +08:00
|
|
|
Optionality optionality{Optionality::required};
|
2020-10-20 18:39:26 +08:00
|
|
|
common::Intent intent{common::Intent::In};
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &Dump(llvm::raw_ostream &) const;
|
2018-09-29 08:02:11 +08:00
|
|
|
};
|
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// constexpr abbreviations for popular arguments:
|
|
|
|
// DefaultingKIND is a KIND= argument whose default value is the appropriate
|
|
|
|
// KIND(0), KIND(0.0), KIND(''), &c. value for the function result.
|
2018-10-06 02:32:54 +08:00
|
|
|
static constexpr IntrinsicDummyArgument DefaultingKIND{"kind",
|
2018-10-16 03:17:30 +08:00
|
|
|
{IntType, KindCode::kindArg}, Rank::scalar,
|
2020-11-04 02:45:01 +08:00
|
|
|
Optionality::defaultsToDefaultForResult, common::Intent::In};
|
2018-10-05 04:43:33 +08:00
|
|
|
// MatchingDefaultKIND is a KIND= argument whose default value is the
|
|
|
|
// kind of any "Same" function argument (viz., the one whose kind pattern is
|
|
|
|
// "same").
|
2018-10-06 02:32:54 +08:00
|
|
|
static constexpr IntrinsicDummyArgument MatchingDefaultKIND{"kind",
|
2020-11-04 02:45:01 +08:00
|
|
|
{IntType, KindCode::kindArg}, Rank::scalar, Optionality::defaultsToSameKind,
|
|
|
|
common::Intent::In};
|
2020-01-04 08:32:23 +08:00
|
|
|
// SizeDefaultKind is a KIND= argument whose default value should be
|
|
|
|
// the kind of INTEGER used for address calculations, and can be
|
|
|
|
// set so with a compiler flag; but the standard mandates the
|
|
|
|
// kind of default INTEGER.
|
|
|
|
static constexpr IntrinsicDummyArgument SizeDefaultKIND{"kind",
|
2020-11-04 02:45:01 +08:00
|
|
|
{IntType, KindCode::kindArg}, Rank::scalar, Optionality::defaultsToSizeKind,
|
|
|
|
common::Intent::In};
|
|
|
|
static constexpr IntrinsicDummyArgument RequiredDIM{"dim",
|
|
|
|
{IntType, KindCode::dimArg}, Rank::scalar, Optionality::required,
|
|
|
|
common::Intent::In};
|
|
|
|
static constexpr IntrinsicDummyArgument OptionalDIM{"dim",
|
|
|
|
{IntType, KindCode::dimArg}, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::In};
|
2021-01-15 04:54:31 +08:00
|
|
|
static constexpr IntrinsicDummyArgument MissingDIM{"dim",
|
|
|
|
{IntType, KindCode::dimArg}, Rank::scalar, Optionality::missing,
|
|
|
|
common::Intent::In};
|
2020-11-04 02:45:01 +08:00
|
|
|
static constexpr IntrinsicDummyArgument OptionalMASK{"mask", AnyLogical,
|
|
|
|
Rank::conformable, Optionality::optional, common::Intent::In};
|
2018-09-29 08:02:11 +08:00
|
|
|
|
|
|
|
struct IntrinsicInterface {
|
2020-03-29 12:00:16 +08:00
|
|
|
static constexpr int maxArguments{7}; // if not a MAX/MIN(...)
|
2018-10-02 02:27:45 +08:00
|
|
|
const char *name{nullptr};
|
2018-09-29 08:02:11 +08:00
|
|
|
IntrinsicDummyArgument dummy[maxArguments];
|
|
|
|
TypePattern result;
|
2018-10-05 04:43:33 +08:00
|
|
|
Rank rank{Rank::elemental};
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
IntrinsicClass intrinsicClass{IntrinsicClass::elementalFunction};
|
2018-10-18 06:09:48 +08:00
|
|
|
std::optional<SpecificCall> Match(const CallCharacteristics &,
|
2019-01-19 04:40:47 +08:00
|
|
|
const common::IntrinsicTypeDefaultKinds &, ActualArguments &,
|
2019-04-19 05:11:15 +08:00
|
|
|
FoldingContext &context) const;
|
2019-02-23 07:45:30 +08:00
|
|
|
int CountArguments() const;
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &Dump(llvm::raw_ostream &) const;
|
2018-09-29 08:02:11 +08:00
|
|
|
};
|
|
|
|
|
2019-02-23 07:45:30 +08:00
|
|
|
int IntrinsicInterface::CountArguments() const {
|
|
|
|
int n{0};
|
2019-11-10 01:29:31 +08:00
|
|
|
while (n < maxArguments && dummy[n].keyword) {
|
2019-02-23 07:45:30 +08:00
|
|
|
++n;
|
|
|
|
}
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2018-10-16 04:39:51 +08:00
|
|
|
// GENERIC INTRINSIC FUNCTION INTERFACES
|
|
|
|
// Each entry in this table defines a pattern. Some intrinsic
|
|
|
|
// functions have more than one such pattern. Besides the name
|
|
|
|
// of the intrinsic function, each pattern has specifications for
|
|
|
|
// the dummy arguments and for the result of the function.
|
2019-05-14 00:33:18 +08:00
|
|
|
// The dummy argument patterns each have a name (these are from the
|
2018-10-16 04:39:51 +08:00
|
|
|
// standard, but rarely appear in actual code), a type and kind
|
|
|
|
// pattern, allowable ranks, and optionality indicators.
|
|
|
|
// Be advised, the default rank pattern is "elemental".
|
2018-10-02 02:27:45 +08:00
|
|
|
static const IntrinsicInterface genericIntrinsicFunction[]{
|
2018-10-05 04:43:33 +08:00
|
|
|
{"abs", {{"a", SameIntOrReal}}, SameIntOrReal},
|
|
|
|
{"abs", {{"a", SameComplex}}, SameReal},
|
2019-07-10 02:54:11 +08:00
|
|
|
{"achar", {{"i", AnyInt, Rank::elementalOrBOZ}, DefaultingKIND}, KINDChar},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"acos", {{"x", SameFloating}}, SameFloating},
|
2019-12-12 07:06:24 +08:00
|
|
|
{"acosd", {{"x", SameFloating}}, SameFloating},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"acosh", {{"x", SameFloating}}, SameFloating},
|
|
|
|
{"adjustl", {{"string", SameChar}}, SameChar},
|
|
|
|
{"adjustr", {{"string", SameChar}}, SameChar},
|
|
|
|
{"aimag", {{"x", SameComplex}}, SameReal},
|
|
|
|
{"aint", {{"a", SameReal}, MatchingDefaultKIND}, KINDReal},
|
|
|
|
{"all", {{"mask", SameLogical, Rank::array}, OptionalDIM}, SameLogical,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
|
|
|
{"allocated", {{"array", AnyData, Rank::array}}, DefaultLogical,
|
|
|
|
Rank::elemental, IntrinsicClass::inquiryFunction},
|
|
|
|
{"allocated", {{"scalar", AnyData, Rank::scalar}}, DefaultLogical,
|
|
|
|
Rank::elemental, IntrinsicClass::inquiryFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"anint", {{"a", SameReal}, MatchingDefaultKIND}, KINDReal},
|
|
|
|
{"any", {{"mask", SameLogical, Rank::array}, OptionalDIM}, SameLogical,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"asin", {{"x", SameFloating}}, SameFloating},
|
2019-12-12 07:06:24 +08:00
|
|
|
{"asind", {{"x", SameFloating}}, SameFloating},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"asinh", {{"x", SameFloating}}, SameFloating},
|
2019-06-22 05:04:40 +08:00
|
|
|
{"associated",
|
2020-09-26 00:03:17 +08:00
|
|
|
{{"pointer", AnyPointer, Rank::known},
|
2019-08-13 01:56:18 +08:00
|
|
|
{"target", Addressable, Rank::known, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
DefaultLogical, Rank::elemental, IntrinsicClass::inquiryFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"atan", {{"x", SameFloating}}, SameFloating},
|
2019-12-12 07:06:24 +08:00
|
|
|
{"atand", {{"x", SameFloating}}, SameFloating},
|
2019-07-18 03:51:52 +08:00
|
|
|
{"atan", {{"y", OperandReal}, {"x", OperandReal}}, OperandReal},
|
2019-12-12 07:06:24 +08:00
|
|
|
{"atand", {{"y", OperandReal}, {"x", OperandReal}}, OperandReal},
|
2019-07-18 03:51:52 +08:00
|
|
|
{"atan2", {{"y", OperandReal}, {"x", OperandReal}}, OperandReal},
|
2019-12-12 07:06:24 +08:00
|
|
|
{"atan2d", {{"y", OperandReal}, {"x", OperandReal}}, OperandReal},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"atanh", {{"x", SameFloating}}, SameFloating},
|
|
|
|
{"bessel_j0", {{"x", SameReal}}, SameReal},
|
|
|
|
{"bessel_j1", {{"x", SameReal}}, SameReal},
|
|
|
|
{"bessel_jn", {{"n", AnyInt}, {"x", SameReal}}, SameReal},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"bessel_jn",
|
|
|
|
{{"n1", AnyInt, Rank::scalar}, {"n2", AnyInt, Rank::scalar},
|
|
|
|
{"x", SameReal, Rank::scalar}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameReal, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"bessel_y0", {{"x", SameReal}}, SameReal},
|
|
|
|
{"bessel_y1", {{"x", SameReal}}, SameReal},
|
|
|
|
{"bessel_yn", {{"n", AnyInt}, {"x", SameReal}}, SameReal},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"bessel_yn",
|
|
|
|
{{"n1", AnyInt, Rank::scalar}, {"n2", AnyInt, Rank::scalar},
|
|
|
|
{"x", SameReal, Rank::scalar}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameReal, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"bge",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"i", AnyInt, Rank::elementalOrBOZ},
|
|
|
|
{"j", AnyInt, Rank::elementalOrBOZ}},
|
2018-10-17 05:42:22 +08:00
|
|
|
DefaultLogical},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"bgt",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"i", AnyInt, Rank::elementalOrBOZ},
|
|
|
|
{"j", AnyInt, Rank::elementalOrBOZ}},
|
2018-10-17 05:42:22 +08:00
|
|
|
DefaultLogical},
|
2019-07-26 01:16:28 +08:00
|
|
|
{"bit_size", {{"i", SameInt, Rank::anyOrAssumedRank}}, SameInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"ble",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"i", AnyInt, Rank::elementalOrBOZ},
|
|
|
|
{"j", AnyInt, Rank::elementalOrBOZ}},
|
2018-10-17 05:42:22 +08:00
|
|
|
DefaultLogical},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"blt",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"i", AnyInt, Rank::elementalOrBOZ},
|
|
|
|
{"j", AnyInt, Rank::elementalOrBOZ}},
|
2018-10-17 05:42:22 +08:00
|
|
|
DefaultLogical},
|
2019-07-10 02:54:11 +08:00
|
|
|
{"btest", {{"i", AnyInt, Rank::elementalOrBOZ}, {"pos", AnyInt}},
|
|
|
|
DefaultLogical},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"ceiling", {{"a", AnyReal}, DefaultingKIND}, KINDInt},
|
2019-07-10 02:54:11 +08:00
|
|
|
{"char", {{"i", AnyInt, Rank::elementalOrBOZ}, DefaultingKIND}, KINDChar},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"cmplx", {{"x", AnyComplex}, DefaultingKIND}, KINDComplex},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"cmplx",
|
2019-06-05 01:50:34 +08:00
|
|
|
{{"x", AnyIntOrReal, Rank::elementalOrBOZ},
|
|
|
|
{"y", AnyIntOrReal, Rank::elementalOrBOZ, Optionality::optional},
|
2019-05-04 02:29:15 +08:00
|
|
|
DefaultingKIND},
|
2018-10-05 04:43:33 +08:00
|
|
|
KINDComplex},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{"command_argument_count", {}, DefaultInt, Rank::scalar,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"conjg", {{"z", SameComplex}}, SameComplex},
|
|
|
|
{"cos", {{"x", SameFloating}}, SameFloating},
|
2019-12-12 07:06:24 +08:00
|
|
|
{"cosd", {{"x", SameFloating}}, SameFloating},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"cosh", {{"x", SameFloating}}, SameFloating},
|
|
|
|
{"count", {{"mask", AnyLogical, Rank::array}, OptionalDIM, DefaultingKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"cshift",
|
2021-01-15 04:54:31 +08:00
|
|
|
{{"array", SameType, Rank::array},
|
|
|
|
{"shift", AnyInt, Rank::dimRemovedOrScalar}, OptionalDIM},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::conformable, IntrinsicClass::transformationalFunction},
|
2018-10-18 06:09:48 +08:00
|
|
|
{"dble", {{"a", AnyNumeric, Rank::elementalOrBOZ}}, DoublePrecision},
|
2019-08-06 00:42:06 +08:00
|
|
|
{"digits", {{"x", AnyIntOrReal, Rank::anyOrAssumedRank}}, DefaultInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2019-07-18 03:51:52 +08:00
|
|
|
{"dim", {{"x", OperandIntOrReal}, {"y", OperandIntOrReal}},
|
|
|
|
OperandIntOrReal},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"dot_product",
|
|
|
|
{{"vector_a", AnyLogical, Rank::vector},
|
|
|
|
{"vector_b", AnyLogical, Rank::vector}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultLogical, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"dot_product",
|
|
|
|
{{"vector_a", AnyComplex, Rank::vector},
|
|
|
|
{"vector_b", AnyNumeric, Rank::vector}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultNumeric, Rank::scalar, // conjugates vector_a
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"dot_product",
|
|
|
|
{{"vector_a", AnyIntOrReal, Rank::vector},
|
|
|
|
{"vector_b", AnyNumeric, Rank::vector}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultNumeric, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"dprod", {{"x", DefaultReal}, {"y", DefaultReal}}, DoublePrecision},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"dshiftl",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"shift", AnyInt}},
|
|
|
|
SameInt},
|
|
|
|
{"dshiftl", {{"i", BOZ}, {"j", SameInt}, {"shift", AnyInt}}, SameInt},
|
|
|
|
{"dshiftr",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"shift", AnyInt}},
|
|
|
|
SameInt},
|
|
|
|
{"dshiftr", {{"i", BOZ}, {"j", SameInt}, {"shift", AnyInt}}, SameInt},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"eoshift",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"array", SameIntrinsic, Rank::array},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"shift", AnyInt, Rank::dimRemovedOrScalar},
|
|
|
|
{"boundary", SameIntrinsic, Rank::dimReduced,
|
2018-10-06 02:32:54 +08:00
|
|
|
Optionality::optional},
|
2018-10-05 04:43:33 +08:00
|
|
|
OptionalDIM},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameIntrinsic, Rank::conformable,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"eoshift",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"array", SameDerivedType, Rank::array},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"shift", AnyInt, Rank::dimReduced},
|
|
|
|
{"boundary", SameDerivedType, Rank::dimReduced}, OptionalDIM},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameDerivedType, Rank::conformable,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2019-07-25 04:55:29 +08:00
|
|
|
{"epsilon", {{"x", SameReal, Rank::anyOrAssumedRank}}, SameReal,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"erf", {{"x", SameReal}}, SameReal},
|
|
|
|
{"erfc", {{"x", SameReal}}, SameReal},
|
|
|
|
{"erfc_scaled", {{"x", SameReal}}, SameReal},
|
|
|
|
{"exp", {{"x", SameFloating}}, SameFloating},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{"exp", {{"x", SameFloating}}, SameFloating},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"exponent", {{"x", AnyReal}}, DefaultInt},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{"exp", {{"x", SameFloating}}, SameFloating},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"extends_type_of",
|
|
|
|
{{"a", ExtensibleDerived, Rank::anyOrAssumedRank},
|
|
|
|
{"mold", ExtensibleDerived, Rank::anyOrAssumedRank}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
DefaultLogical, Rank::scalar, IntrinsicClass::inquiryFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"findloc",
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"array", AnyNumeric, Rank::array},
|
2019-06-26 04:07:32 +08:00
|
|
|
{"value", AnyNumeric, Rank::scalar}, RequiredDIM, OptionalMASK,
|
2020-01-04 08:32:23 +08:00
|
|
|
SizeDefaultKIND,
|
2018-10-06 02:32:54 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
2021-01-15 04:54:31 +08:00
|
|
|
KINDInt, Rank::locReduced, IntrinsicClass::transformationalFunction},
|
2019-06-26 04:07:32 +08:00
|
|
|
{"findloc",
|
|
|
|
{{"array", AnyNumeric, Rank::array},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"value", AnyNumeric, Rank::scalar}, MissingDIM, OptionalMASK,
|
|
|
|
SizeDefaultKIND,
|
2019-06-26 04:07:32 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"findloc",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"array", SameChar, Rank::array}, {"value", SameChar, Rank::scalar},
|
2020-01-04 08:32:23 +08:00
|
|
|
RequiredDIM, OptionalMASK, SizeDefaultKIND,
|
2018-10-06 02:32:54 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
2021-01-15 04:54:31 +08:00
|
|
|
KINDInt, Rank::locReduced, IntrinsicClass::transformationalFunction},
|
2019-06-26 04:07:32 +08:00
|
|
|
{"findloc",
|
|
|
|
{{"array", SameChar, Rank::array}, {"value", SameChar, Rank::scalar},
|
2021-01-15 04:54:31 +08:00
|
|
|
MissingDIM, OptionalMASK, SizeDefaultKIND,
|
2019-06-26 04:07:32 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"findloc",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"array", AnyLogical, Rank::array},
|
2019-06-26 04:07:32 +08:00
|
|
|
{"value", AnyLogical, Rank::scalar}, RequiredDIM, OptionalMASK,
|
2020-01-04 08:32:23 +08:00
|
|
|
SizeDefaultKIND,
|
2018-10-06 02:32:54 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
2021-01-15 04:54:31 +08:00
|
|
|
KINDInt, Rank::locReduced, IntrinsicClass::transformationalFunction},
|
2019-06-26 04:07:32 +08:00
|
|
|
{"findloc",
|
|
|
|
{{"array", AnyLogical, Rank::array},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"value", AnyLogical, Rank::scalar}, MissingDIM, OptionalMASK,
|
|
|
|
SizeDefaultKIND,
|
2019-06-26 04:07:32 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"floor", {{"a", AnyReal}, DefaultingKIND}, KINDInt},
|
|
|
|
{"fraction", {{"x", SameReal}}, SameReal},
|
|
|
|
{"gamma", {{"x", SameReal}}, SameReal},
|
2019-07-25 04:55:29 +08:00
|
|
|
{"huge", {{"x", SameIntOrReal, Rank::anyOrAssumedRank}}, SameIntOrReal,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2019-07-18 03:51:52 +08:00
|
|
|
{"hypot", {{"x", OperandReal}, {"y", OperandReal}}, OperandReal},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"iachar", {{"c", AnyChar}, DefaultingKIND}, KINDInt},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"iall", {{"array", SameInt, Rank::array}, RequiredDIM, OptionalMASK},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameInt, Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"iall", {{"array", SameInt, Rank::array}, MissingDIM, OptionalMASK},
|
|
|
|
SameInt, Rank::scalar, IntrinsicClass::transformationalFunction},
|
|
|
|
{"iany", {{"array", SameInt, Rank::array}, RequiredDIM, OptionalMASK},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameInt, Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"iany", {{"array", SameInt, Rank::array}, MissingDIM, OptionalMASK},
|
|
|
|
SameInt, Rank::scalar, IntrinsicClass::transformationalFunction},
|
|
|
|
{"iparity", {{"array", SameInt, Rank::array}, RequiredDIM, OptionalMASK},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameInt, Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"iparity", {{"array", SameInt, Rank::array}, MissingDIM, OptionalMASK},
|
|
|
|
SameInt, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"iand", {{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ}}, SameInt},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"iand", {{"i", BOZ}, {"j", SameInt}}, SameInt},
|
|
|
|
{"ibclr", {{"i", SameInt}, {"pos", AnyInt}}, SameInt},
|
|
|
|
{"ibits", {{"i", SameInt}, {"pos", AnyInt}, {"len", AnyInt}}, SameInt},
|
|
|
|
{"ibset", {{"i", SameInt}, {"pos", AnyInt}}, SameInt},
|
|
|
|
{"ichar", {{"c", AnyChar}, DefaultingKIND}, KINDInt},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"ieor", {{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ}}, SameInt},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"ieor", {{"i", BOZ}, {"j", SameInt}}, SameInt},
|
|
|
|
{"image_status",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"image", SameInt},
|
|
|
|
{"team", TEAM_TYPE, Rank::scalar, Optionality::optional}},
|
2018-10-17 05:42:22 +08:00
|
|
|
DefaultInt},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"index",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"string", SameChar}, {"substring", SameChar},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional},
|
2019-10-17 02:53:03 +08:00
|
|
|
DefaultingKIND},
|
2018-10-05 04:43:33 +08:00
|
|
|
KINDInt},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"int", {{"a", AnyNumeric, Rank::elementalOrBOZ}, DefaultingKIND}, KINDInt},
|
2019-08-27 05:58:10 +08:00
|
|
|
{"int_ptr_kind", {}, DefaultInt, Rank::scalar},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"ior", {{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ}}, SameInt},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"ior", {{"i", BOZ}, {"j", SameInt}}, SameInt},
|
|
|
|
{"ishft", {{"i", SameInt}, {"shift", AnyInt}}, SameInt},
|
|
|
|
{"ishftc",
|
|
|
|
{{"i", SameInt}, {"shift", AnyInt},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"size", AnyInt, Rank::elemental, Optionality::optional}},
|
2018-10-05 04:43:33 +08:00
|
|
|
SameInt},
|
2020-11-11 07:07:53 +08:00
|
|
|
{"isnan", {{"a", AnyFloating}}, DefaultLogical},
|
2020-01-08 05:39:42 +08:00
|
|
|
{"is_contiguous", {{"array", Addressable, Rank::anyOrAssumedRank}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
DefaultLogical, Rank::elemental, IntrinsicClass::inquiryFunction},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"is_iostat_end", {{"i", AnyInt}}, DefaultLogical},
|
|
|
|
{"is_iostat_eor", {{"i", AnyInt}}, DefaultLogical},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{"kind", {{"x", AnyIntrinsic}}, DefaultInt, Rank::elemental,
|
|
|
|
IntrinsicClass::inquiryFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"lbound",
|
2019-09-17 07:58:13 +08:00
|
|
|
{{"array", AnyData, Rank::anyOrAssumedRank}, RequiredDIM,
|
2020-01-04 08:32:23 +08:00
|
|
|
SizeDefaultKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::scalar, IntrinsicClass::inquiryFunction},
|
2020-01-04 08:32:23 +08:00
|
|
|
{"lbound", {{"array", AnyData, Rank::anyOrAssumedRank}, SizeDefaultKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::vector, IntrinsicClass::inquiryFunction},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"leadz", {{"i", AnyInt}}, DefaultInt},
|
2019-10-17 02:53:03 +08:00
|
|
|
{"len", {{"string", AnyChar, Rank::anyOrAssumedRank}, DefaultingKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::scalar, IntrinsicClass::inquiryFunction},
|
2019-10-17 02:53:03 +08:00
|
|
|
{"len_trim", {{"string", AnyChar}, DefaultingKIND}, KINDInt},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"lge", {{"string_a", SameChar}, {"string_b", SameChar}}, DefaultLogical},
|
|
|
|
{"lgt", {{"string_a", SameChar}, {"string_b", SameChar}}, DefaultLogical},
|
|
|
|
{"lle", {{"string_a", SameChar}, {"string_b", SameChar}}, DefaultLogical},
|
|
|
|
{"llt", {{"string_a", SameChar}, {"string_b", SameChar}}, DefaultLogical},
|
2019-11-08 08:01:38 +08:00
|
|
|
{"loc", {{"loc_argument", Addressable, Rank::anyOrAssumedRank}},
|
|
|
|
SubscriptInt, Rank::scalar},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"log", {{"x", SameFloating}}, SameFloating},
|
|
|
|
{"log10", {{"x", SameReal}}, SameReal},
|
|
|
|
{"logical", {{"l", AnyLogical}, DefaultingKIND}, KINDLogical},
|
|
|
|
{"log_gamma", {{"x", SameReal}}, SameReal},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"matmul",
|
2020-06-20 09:11:46 +08:00
|
|
|
{{"matrix_a", AnyLogical, Rank::vector},
|
|
|
|
{"matrix_b", AnyLogical, Rank::matrix}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultLogical, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"matmul",
|
2020-06-20 09:11:46 +08:00
|
|
|
{{"matrix_a", AnyLogical, Rank::matrix},
|
|
|
|
{"matrix_b", AnyLogical, Rank::vector}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultLogical, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"matmul",
|
2020-06-20 09:11:46 +08:00
|
|
|
{{"matrix_a", AnyLogical, Rank::matrix},
|
|
|
|
{"matrix_b", AnyLogical, Rank::matrix}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultLogical, Rank::matrix, IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"matmul",
|
2020-06-20 09:11:46 +08:00
|
|
|
{{"matrix_a", AnyNumeric, Rank::vector},
|
|
|
|
{"matrix_b", AnyNumeric, Rank::matrix}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultNumeric, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"matmul",
|
2020-06-20 09:11:46 +08:00
|
|
|
{{"matrix_a", AnyNumeric, Rank::matrix},
|
|
|
|
{"matrix_b", AnyNumeric, Rank::vector}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultNumeric, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"matmul",
|
2020-06-20 09:11:46 +08:00
|
|
|
{{"matrix_a", AnyNumeric, Rank::matrix},
|
|
|
|
{"matrix_b", AnyNumeric, Rank::matrix}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
ResultNumeric, Rank::matrix, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"maskl", {{"i", AnyInt}, DefaultingKIND}, KINDInt},
|
|
|
|
{"maskr", {{"i", AnyInt}, DefaultingKIND}, KINDInt},
|
2018-10-12 05:51:14 +08:00
|
|
|
{"max",
|
2019-07-18 03:51:52 +08:00
|
|
|
{{"a1", OperandIntOrReal}, {"a2", OperandIntOrReal},
|
|
|
|
{"a3", OperandIntOrReal, Rank::elemental, Optionality::repeats}},
|
|
|
|
OperandIntOrReal},
|
|
|
|
{"max",
|
|
|
|
{{"a1", SameChar}, {"a2", SameChar},
|
|
|
|
{"a3", SameChar, Rank::elemental, Optionality::repeats}},
|
|
|
|
SameChar},
|
2019-07-25 04:55:29 +08:00
|
|
|
{"maxexponent", {{"x", AnyReal, Rank::anyOrAssumedRank}}, DefaultInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"maxloc",
|
2021-01-15 04:54:31 +08:00
|
|
|
{{"array", AnyRelatable, Rank::array}, RequiredDIM, OptionalMASK,
|
2020-01-04 08:32:23 +08:00
|
|
|
SizeDefaultKIND,
|
2018-10-06 02:32:54 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
2021-01-15 04:54:31 +08:00
|
|
|
KINDInt, Rank::locReduced, IntrinsicClass::transformationalFunction},
|
|
|
|
{"maxloc",
|
|
|
|
{{"array", AnyRelatable, Rank::array}, MissingDIM, OptionalMASK,
|
|
|
|
SizeDefaultKIND,
|
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
|
|
|
KINDInt, Rank::locReduced, IntrinsicClass::transformationalFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"maxval",
|
2021-01-15 04:54:31 +08:00
|
|
|
{{"array", SameRelatable, Rank::array}, RequiredDIM, OptionalMASK},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameRelatable, Rank::dimReduced,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"maxval",
|
|
|
|
{{"array", SameRelatable, Rank::array}, MissingDIM, OptionalMASK},
|
|
|
|
SameRelatable, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-12 05:51:14 +08:00
|
|
|
{"merge",
|
|
|
|
{{"tsource", SameType}, {"fsource", SameType}, {"mask", AnyLogical}},
|
|
|
|
SameType},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"merge_bits",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ},
|
|
|
|
{"mask", SameInt, Rank::elementalOrBOZ}},
|
2018-10-05 04:43:33 +08:00
|
|
|
SameInt},
|
|
|
|
{"merge_bits",
|
2018-10-06 02:32:54 +08:00
|
|
|
{{"i", BOZ}, {"j", SameInt}, {"mask", SameInt, Rank::elementalOrBOZ}},
|
2018-10-05 04:43:33 +08:00
|
|
|
SameInt},
|
2018-10-12 05:51:14 +08:00
|
|
|
{"min",
|
2019-07-18 03:51:52 +08:00
|
|
|
{{"a1", OperandIntOrReal}, {"a2", OperandIntOrReal},
|
|
|
|
{"a3", OperandIntOrReal, Rank::elemental, Optionality::repeats}},
|
|
|
|
OperandIntOrReal},
|
|
|
|
{"min",
|
|
|
|
{{"a1", SameChar}, {"a2", SameChar},
|
|
|
|
{"a3", SameChar, Rank::elemental, Optionality::repeats}},
|
|
|
|
SameChar},
|
2019-07-25 04:55:29 +08:00
|
|
|
{"minexponent", {{"x", AnyReal, Rank::anyOrAssumedRank}}, DefaultInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"minloc",
|
2021-01-15 04:54:31 +08:00
|
|
|
{{"array", AnyRelatable, Rank::array}, RequiredDIM, OptionalMASK,
|
2020-01-04 08:32:23 +08:00
|
|
|
SizeDefaultKIND,
|
2018-10-06 02:32:54 +08:00
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
2021-01-15 04:54:31 +08:00
|
|
|
KINDInt, Rank::locReduced, IntrinsicClass::transformationalFunction},
|
|
|
|
{"minloc",
|
|
|
|
{{"array", AnyRelatable, Rank::array}, MissingDIM, OptionalMASK,
|
|
|
|
SizeDefaultKIND,
|
|
|
|
{"back", AnyLogical, Rank::scalar, Optionality::optional}},
|
|
|
|
KINDInt, Rank::locReduced, IntrinsicClass::transformationalFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"minval",
|
2021-01-15 04:54:31 +08:00
|
|
|
{{"array", SameRelatable, Rank::array}, RequiredDIM, OptionalMASK},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameRelatable, Rank::dimReduced,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"minval",
|
|
|
|
{{"array", SameRelatable, Rank::array}, MissingDIM, OptionalMASK},
|
|
|
|
SameRelatable, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2019-07-18 03:51:52 +08:00
|
|
|
{"mod", {{"a", OperandIntOrReal}, {"p", OperandIntOrReal}},
|
|
|
|
OperandIntOrReal},
|
|
|
|
{"modulo", {{"a", OperandIntOrReal}, {"p", OperandIntOrReal}},
|
|
|
|
OperandIntOrReal},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"nearest", {{"x", SameReal}, {"s", AnyReal}}, SameReal},
|
2019-09-11 18:01:55 +08:00
|
|
|
{"new_line", {{"x", SameChar, Rank::anyOrAssumedRank}}, SameChar,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"nint", {{"a", AnyReal}, DefaultingKIND}, KINDInt},
|
|
|
|
{"norm2", {{"x", SameReal, Rank::array}, OptionalDIM}, SameReal,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"not", {{"i", SameInt}}, SameInt},
|
2018-10-11 01:48:12 +08:00
|
|
|
// NULL() is a special case handled in Probe() below
|
2020-07-08 03:31:06 +08:00
|
|
|
{"num_images", {}, DefaultInt, Rank::scalar,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
|
|
|
{"num_images", {{"team_number", AnyInt, Rank::scalar}}, DefaultInt,
|
|
|
|
Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"out_of_range",
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"x", AnyIntOrReal}, {"mold", AnyIntOrReal, Rank::scalar}},
|
2018-10-17 05:42:22 +08:00
|
|
|
DefaultLogical},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"out_of_range",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"x", AnyReal}, {"mold", AnyInt, Rank::scalar},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"round", AnyLogical, Rank::scalar, Optionality::optional}},
|
2018-10-17 05:42:22 +08:00
|
|
|
DefaultLogical},
|
|
|
|
{"out_of_range", {{"x", AnyReal}, {"mold", AnyReal}}, DefaultLogical},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"pack",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"array", SameType, Rank::array},
|
|
|
|
{"mask", AnyLogical, Rank::conformable},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"vector", SameType, Rank::vector, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"parity", {{"mask", SameLogical, Rank::array}, OptionalDIM}, SameLogical,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"popcnt", {{"i", AnyInt}}, DefaultInt},
|
|
|
|
{"poppar", {{"i", AnyInt}}, DefaultInt},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"product",
|
2021-01-15 04:54:31 +08:00
|
|
|
{{"array", SameNumeric, Rank::array}, RequiredDIM, OptionalMASK},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameNumeric, Rank::dimReduced,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"product", {{"array", SameNumeric, Rank::array}, MissingDIM, OptionalMASK},
|
|
|
|
SameNumeric, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2019-08-06 00:42:06 +08:00
|
|
|
{"precision", {{"x", AnyFloating, Rank::anyOrAssumedRank}}, DefaultInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2019-08-13 01:56:18 +08:00
|
|
|
{"present", {{"a", Addressable, Rank::anyOrAssumedRank}}, DefaultLogical,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2019-08-06 00:42:06 +08:00
|
|
|
{"radix", {{"x", AnyIntOrReal, Rank::anyOrAssumedRank}}, DefaultInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2019-07-25 04:55:29 +08:00
|
|
|
{"range", {{"x", AnyNumeric, Rank::anyOrAssumedRank}}, DefaultInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
|
|
|
{"rank", {{"a", AnyData, Rank::anyOrAssumedRank}}, DefaultInt, Rank::scalar,
|
|
|
|
IntrinsicClass::inquiryFunction},
|
2019-12-24 03:16:00 +08:00
|
|
|
{"real", {{"a", SameComplex, Rank::elemental}},
|
2020-03-29 12:00:16 +08:00
|
|
|
SameReal}, // 16.9.160(4)(ii)
|
2018-10-06 02:32:54 +08:00
|
|
|
{"real", {{"a", AnyNumeric, Rank::elementalOrBOZ}, DefaultingKIND},
|
2018-10-05 04:43:33 +08:00
|
|
|
KINDReal},
|
2018-10-12 05:51:14 +08:00
|
|
|
{"reduce",
|
|
|
|
{{"array", SameType, Rank::array},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"operation", SameType, Rank::reduceOperation}, RequiredDIM,
|
2018-10-12 05:51:14 +08:00
|
|
|
OptionalMASK, {"identity", SameType, Rank::scalar},
|
|
|
|
{"ordered", AnyLogical, Rank::scalar, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"reduce",
|
|
|
|
{{"array", SameType, Rank::array},
|
|
|
|
{"operation", SameType, Rank::reduceOperation}, MissingDIM,
|
|
|
|
OptionalMASK, {"identity", SameType, Rank::scalar},
|
|
|
|
{"ordered", AnyLogical, Rank::scalar, Optionality::optional}},
|
|
|
|
SameType, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-11 07:45:17 +08:00
|
|
|
{"repeat", {{"string", SameChar, Rank::scalar}, {"ncopies", AnyInt}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameChar, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"reshape",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"source", SameType, Rank::array}, {"shape", AnyInt, Rank::shape},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"pad", SameType, Rank::array, Optionality::optional},
|
|
|
|
{"order", AnyInt, Rank::vector, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::shaped, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"rrspacing", {{"x", SameReal}}, SameReal},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"same_type_as",
|
|
|
|
{{"a", ExtensibleDerived, Rank::anyOrAssumedRank},
|
|
|
|
{"b", ExtensibleDerived, Rank::anyOrAssumedRank}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
DefaultLogical, Rank::scalar, IntrinsicClass::inquiryFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"scale", {{"x", SameReal}, {"i", AnyInt}}, SameReal},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"scan",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"string", SameChar}, {"set", SameChar},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"back", AnyLogical, Rank::elemental, Optionality::optional},
|
2019-10-17 02:53:03 +08:00
|
|
|
DefaultingKIND},
|
2018-10-05 04:43:33 +08:00
|
|
|
KINDInt},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"selected_char_kind", {{"name", DefaultChar, Rank::scalar}}, DefaultInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"selected_int_kind", {{"r", AnyInt, Rank::scalar}}, DefaultInt,
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-12 05:51:14 +08:00
|
|
|
{"selected_real_kind",
|
|
|
|
{{"p", AnyInt, Rank::scalar},
|
|
|
|
{"r", AnyInt, Rank::scalar, Optionality::optional},
|
|
|
|
{"radix", AnyInt, Rank::scalar, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
DefaultInt, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-12 05:51:14 +08:00
|
|
|
{"selected_real_kind",
|
|
|
|
{{"p", AnyInt, Rank::scalar, Optionality::optional},
|
|
|
|
{"r", AnyInt, Rank::scalar},
|
|
|
|
{"radix", AnyInt, Rank::scalar, Optionality::optional}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
DefaultInt, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-12 05:51:14 +08:00
|
|
|
{"selected_real_kind",
|
|
|
|
{{"p", AnyInt, Rank::scalar, Optionality::optional},
|
|
|
|
{"r", AnyInt, Rank::scalar, Optionality::optional},
|
|
|
|
{"radix", AnyInt, Rank::scalar}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
DefaultInt, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"set_exponent", {{"x", SameReal}, {"i", AnyInt}}, SameReal},
|
2020-01-04 08:32:23 +08:00
|
|
|
{"shape", {{"source", AnyData, Rank::anyOrAssumedRank}, SizeDefaultKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::vector, IntrinsicClass::inquiryFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"shifta", {{"i", SameInt}, {"shift", AnyInt}}, SameInt},
|
|
|
|
{"shiftl", {{"i", SameInt}, {"shift", AnyInt}}, SameInt},
|
|
|
|
{"shiftr", {{"i", SameInt}, {"shift", AnyInt}}, SameInt},
|
|
|
|
{"sign", {{"a", SameIntOrReal}, {"b", SameIntOrReal}}, SameIntOrReal},
|
|
|
|
{"sin", {{"x", SameFloating}}, SameFloating},
|
2019-12-12 07:06:24 +08:00
|
|
|
{"sind", {{"x", SameFloating}}, SameFloating},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"sinh", {{"x", SameFloating}}, SameFloating},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"size",
|
2019-09-17 07:58:13 +08:00
|
|
|
{{"array", AnyData, Rank::anyOrAssumedRank}, OptionalDIM,
|
2020-01-04 08:32:23 +08:00
|
|
|
SizeDefaultKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::scalar, IntrinsicClass::inquiryFunction},
|
2020-12-16 03:06:44 +08:00
|
|
|
{"sizeof", {{"a", AnyData, Rank::anyOrAssumedRank}}, SubscriptInt,
|
|
|
|
Rank::scalar, IntrinsicClass::inquiryFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"spacing", {{"x", SameReal}}, SameReal},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"spread",
|
2019-06-26 04:07:32 +08:00
|
|
|
{{"source", SameType, Rank::known}, RequiredDIM,
|
2018-10-05 04:43:33 +08:00
|
|
|
{"ncopies", AnyInt, Rank::scalar}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::rankPlus1, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"sqrt", {{"x", SameFloating}}, SameFloating},
|
2020-01-04 08:32:23 +08:00
|
|
|
{"storage_size", {{"a", AnyData, Rank::anyOrAssumedRank}, SizeDefaultKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::scalar, IntrinsicClass::inquiryFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"sum", {{"array", SameNumeric, Rank::array}, RequiredDIM, OptionalMASK},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameNumeric, Rank::dimReduced,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2021-01-15 04:54:31 +08:00
|
|
|
{"sum", {{"array", SameNumeric, Rank::array}, MissingDIM, OptionalMASK},
|
|
|
|
SameNumeric, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"tan", {{"x", SameFloating}}, SameFloating},
|
2019-12-12 07:06:24 +08:00
|
|
|
{"tand", {{"x", SameFloating}}, SameFloating},
|
2018-10-05 04:43:33 +08:00
|
|
|
{"tanh", {{"x", SameFloating}}, SameFloating},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{"tiny", {{"x", SameReal, Rank::anyOrAssumedRank}}, SameReal, Rank::scalar,
|
|
|
|
IntrinsicClass::inquiryFunction},
|
2018-10-17 05:42:22 +08:00
|
|
|
{"trailz", {{"i", AnyInt}}, DefaultInt},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"transfer",
|
2019-09-17 07:58:13 +08:00
|
|
|
{{"source", AnyData, Rank::known}, {"mold", SameType, Rank::scalar}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::scalar, IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"transfer",
|
2019-09-17 07:58:13 +08:00
|
|
|
{{"source", AnyData, Rank::known}, {"mold", SameType, Rank::array}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::vector, IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"transfer",
|
2019-09-17 07:58:13 +08:00
|
|
|
{{"source", AnyData, Rank::anyOrAssumedRank},
|
2018-12-15 03:23:14 +08:00
|
|
|
{"mold", SameType, Rank::anyOrAssumedRank},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"size", AnyInt, Rank::scalar}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::vector, IntrinsicClass::transformationalFunction},
|
|
|
|
{"transpose", {{"matrix", SameType, Rank::matrix}}, SameType, Rank::matrix,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
|
|
|
{"trim", {{"string", SameChar, Rank::scalar}}, SameChar, Rank::scalar,
|
|
|
|
IntrinsicClass::transformationalFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"ubound",
|
2019-09-17 07:58:13 +08:00
|
|
|
{{"array", AnyData, Rank::anyOrAssumedRank}, RequiredDIM,
|
2020-01-04 08:32:23 +08:00
|
|
|
SizeDefaultKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::scalar, IntrinsicClass::inquiryFunction},
|
2020-01-04 08:32:23 +08:00
|
|
|
{"ubound", {{"array", AnyData, Rank::anyOrAssumedRank}, SizeDefaultKIND},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
KINDInt, Rank::vector, IntrinsicClass::inquiryFunction},
|
2018-10-10 03:07:29 +08:00
|
|
|
{"unpack",
|
|
|
|
{{"vector", SameType, Rank::vector}, {"mask", AnyLogical, Rank::array},
|
|
|
|
{"field", SameType, Rank::conformable}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
SameType, Rank::conformable, IntrinsicClass::transformationalFunction},
|
2018-09-29 08:02:11 +08:00
|
|
|
{"verify",
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"string", SameChar}, {"set", SameChar},
|
2018-10-06 02:32:54 +08:00
|
|
|
{"back", AnyLogical, Rank::elemental, Optionality::optional},
|
2019-10-17 02:53:03 +08:00
|
|
|
DefaultingKIND},
|
2018-10-05 04:43:33 +08:00
|
|
|
KINDInt},
|
2018-09-29 08:02:11 +08:00
|
|
|
};
|
|
|
|
|
2018-10-11 01:48:12 +08:00
|
|
|
// TODO: Coarray intrinsic functions
|
2018-10-12 05:51:14 +08:00
|
|
|
// LCOBOUND, UCOBOUND, FAILED_IMAGES, GET_TEAM, IMAGE_INDEX,
|
2020-07-08 03:31:06 +08:00
|
|
|
// STOPPED_IMAGES, TEAM_NUMBER, THIS_IMAGE,
|
2018-10-12 05:51:14 +08:00
|
|
|
// COSHAPE
|
|
|
|
// TODO: Non-standard intrinsic functions
|
|
|
|
// AND, OR, XOR, LSHIFT, RSHIFT, SHIFT, ZEXT, IZEXT,
|
2019-12-12 07:06:24 +08:00
|
|
|
// COMPL, EQV, NEQV, INT8, JINT, JNINT, KNINT,
|
2019-12-04 02:21:37 +08:00
|
|
|
// QCMPLX, DFLOAT, QEXT, QFLOAT, QREAL, DNUM,
|
2020-12-16 03:06:44 +08:00
|
|
|
// INUM, JNUM, KNUM, QNUM, RNUM, RAN, RANF, ILEN,
|
2018-10-12 05:51:14 +08:00
|
|
|
// MCLOCK, SECNDS, COTAN, IBCHNG, ISHA, ISHC, ISHL, IXOR
|
|
|
|
// IARG, IARGC, NARGS, NUMARG, BADDRESS, IADDR, CACHESIZE,
|
2020-11-11 07:07:53 +08:00
|
|
|
// EOF, FP_CLASS, INT_PTR_KIND, MALLOC
|
2018-10-12 05:51:14 +08:00
|
|
|
// probably more (these are PGI + Intel, possibly incomplete)
|
2019-07-02 04:22:22 +08:00
|
|
|
// TODO: Optionally warn on use of non-standard intrinsics:
|
|
|
|
// LOC, probably others
|
2019-07-18 03:51:52 +08:00
|
|
|
// TODO: Optionally warn on operand promotion extension
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2019-02-23 07:45:30 +08:00
|
|
|
// The following table contains the intrinsic functions listed in
|
|
|
|
// Tables 16.2 and 16.3 in Fortran 2018. The "unrestricted" functions
|
|
|
|
// in Table 16.2 can be used as actual arguments, PROCEDURE() interfaces,
|
|
|
|
// and procedure pointer targets.
|
2019-09-17 00:34:10 +08:00
|
|
|
// Note that the restricted conversion functions dcmplx, dreal, float, idint,
|
2019-09-17 16:54:51 +08:00
|
|
|
// ifix, and sngl are extended to accept any argument kind because this is a
|
|
|
|
// common Fortran compilers behavior, and as far as we can tell, is safe and
|
|
|
|
// useful.
|
2018-09-29 08:02:11 +08:00
|
|
|
struct SpecificIntrinsicInterface : public IntrinsicInterface {
|
|
|
|
const char *generic{nullptr};
|
2019-02-23 07:45:30 +08:00
|
|
|
bool isRestrictedSpecific{false};
|
2019-09-17 00:34:10 +08:00
|
|
|
// Exact actual/dummy type matching is required by default for specific
|
|
|
|
// intrinsics. If useGenericAndForceResultType is set, then the probing will
|
|
|
|
// also attempt to use the related generic intrinsic and to convert the result
|
[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit
Summary:
This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.
- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let
folding rewrite it and introduc the conversion on the MIN/MAX result.
- Also make operand promotion explicit in MIN/MAX folding.
For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))
All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.
Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby
Reviewed By: klausler, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D81940
2020-06-18 13:46:19 +08:00
|
|
|
// to the specific intrinsic result type if needed. This also prevents
|
|
|
|
// using the generic name so that folding can insert the conversion on the
|
|
|
|
// result and not the arguments.
|
|
|
|
//
|
2019-09-17 00:34:10 +08:00
|
|
|
// This is not enabled on all specific intrinsics because an alternative
|
|
|
|
// is to convert the actual arguments to the required dummy types and this is
|
|
|
|
// not numerically equivalent.
|
[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit
Summary:
This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.
- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let
folding rewrite it and introduc the conversion on the MIN/MAX result.
- Also make operand promotion explicit in MIN/MAX folding.
For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))
All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.
Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby
Reviewed By: klausler, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D81940
2020-06-18 13:46:19 +08:00
|
|
|
// e.g. IABS(INT(i, 4)) not equiv to INT(ABS(i), 4).
|
2019-09-17 00:34:10 +08:00
|
|
|
// This is allowed for restricted min/max specific functions because
|
|
|
|
// the expected behavior is clear from their definitions. A warning is though
|
[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit
Summary:
This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.
- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let
folding rewrite it and introduc the conversion on the MIN/MAX result.
- Also make operand promotion explicit in MIN/MAX folding.
For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))
All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.
Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby
Reviewed By: klausler, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D81940
2020-06-18 13:46:19 +08:00
|
|
|
// always emitted because other compilers' behavior is not ubiquitous here and
|
|
|
|
// the results in case of conversion overflow might not be equivalent.
|
|
|
|
// e.g for MIN0: INT(MIN(2147483647_8, 2*2147483647_8), 4) = 2147483647_4
|
|
|
|
// but: MIN(INT(2147483647_8, 4), INT(2*2147483647_8, 4)) = -2_4
|
|
|
|
// xlf and ifort return the first, and pgfortran the later. f18 will return
|
|
|
|
// the first because this matches more closely the MIN0 definition in
|
|
|
|
// Fortran 2018 table 16.3 (although it is still an extension to allow
|
|
|
|
// non default integer argument in MIN0).
|
2019-09-17 00:34:10 +08:00
|
|
|
bool useGenericAndForceResultType{false};
|
2018-09-29 08:02:11 +08:00
|
|
|
};
|
|
|
|
|
2018-10-02 02:27:45 +08:00
|
|
|
static const SpecificIntrinsicInterface specificIntrinsicFunction[]{
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"abs", {{"a", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"acos", {{"x", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"aimag", {{"z", DefaultComplex}}, DefaultReal}},
|
|
|
|
{{"aint", {{"a", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"alog", {{"x", DefaultReal}}, DefaultReal}, "log"},
|
|
|
|
{{"alog10", {{"x", DefaultReal}}, DefaultReal}, "log10"},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"amax0",
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"a1", DefaultInt}, {"a2", DefaultInt},
|
|
|
|
{"a3", DefaultInt, Rank::elemental, Optionality::repeats}},
|
|
|
|
DefaultReal},
|
2019-06-06 06:40:59 +08:00
|
|
|
"max", true, true},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"amax1",
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"a1", DefaultReal}, {"a2", DefaultReal},
|
|
|
|
{"a3", DefaultReal, Rank::elemental, Optionality::repeats}},
|
|
|
|
DefaultReal},
|
2019-06-06 06:40:59 +08:00
|
|
|
"max", true, true},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"amin0",
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"a1", DefaultInt}, {"a2", DefaultInt},
|
|
|
|
{"a3", DefaultInt, Rank::elemental, Optionality::repeats}},
|
|
|
|
DefaultReal},
|
2019-06-06 06:40:59 +08:00
|
|
|
"min", true, true},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"amin1",
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"a1", DefaultReal}, {"a2", DefaultReal},
|
|
|
|
{"a3", DefaultReal, Rank::elemental, Optionality::repeats}},
|
|
|
|
DefaultReal},
|
2019-06-06 06:40:59 +08:00
|
|
|
"min", true, true},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"amod", {{"a", DefaultReal}, {"p", DefaultReal}}, DefaultReal}, "mod"},
|
|
|
|
{{"anint", {{"a", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"asin", {{"x", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"atan", {{"x", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"atan2", {{"y", DefaultReal}, {"x", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"cabs", {{"a", DefaultComplex}}, DefaultReal}, "abs"},
|
|
|
|
{{"ccos", {{"a", DefaultComplex}}, DefaultComplex}, "cos"},
|
2019-06-22 05:04:40 +08:00
|
|
|
{{"cdabs", {{"a", DoublePrecisionComplex}}, DoublePrecision}, "abs"},
|
|
|
|
{{"cdcos", {{"a", DoublePrecisionComplex}}, DoublePrecisionComplex}, "cos"},
|
|
|
|
{{"cdexp", {{"a", DoublePrecisionComplex}}, DoublePrecisionComplex}, "exp"},
|
|
|
|
{{"cdlog", {{"a", DoublePrecisionComplex}}, DoublePrecisionComplex}, "log"},
|
|
|
|
{{"cdsin", {{"a", DoublePrecisionComplex}}, DoublePrecisionComplex}, "sin"},
|
|
|
|
{{"cdsqrt", {{"a", DoublePrecisionComplex}}, DoublePrecisionComplex},
|
|
|
|
"sqrt"},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"cexp", {{"a", DefaultComplex}}, DefaultComplex}, "exp"},
|
|
|
|
{{"clog", {{"a", DefaultComplex}}, DefaultComplex}, "log"},
|
|
|
|
{{"conjg", {{"a", DefaultComplex}}, DefaultComplex}},
|
|
|
|
{{"cos", {{"x", DefaultReal}}, DefaultReal}},
|
2019-12-12 07:06:24 +08:00
|
|
|
{{"cosh", {{"x", DefaultReal}}, DefaultReal}},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"csin", {{"a", DefaultComplex}}, DefaultComplex}, "sin"},
|
|
|
|
{{"csqrt", {{"a", DefaultComplex}}, DefaultComplex}, "sqrt"},
|
|
|
|
{{"ctan", {{"a", DefaultComplex}}, DefaultComplex}, "tan"},
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"dabs", {{"a", DoublePrecision}}, DoublePrecision}, "abs"},
|
|
|
|
{{"dacos", {{"x", DoublePrecision}}, DoublePrecision}, "acos"},
|
|
|
|
{{"dasin", {{"x", DoublePrecision}}, DoublePrecision}, "asin"},
|
|
|
|
{{"datan", {{"x", DoublePrecision}}, DoublePrecision}, "atan"},
|
|
|
|
{{"datan2", {{"y", DoublePrecision}, {"x", DoublePrecision}},
|
|
|
|
DoublePrecision},
|
|
|
|
"atan2"},
|
2019-09-17 00:34:10 +08:00
|
|
|
{{"dcmplx", {{"x", AnyComplex}}, DoublePrecisionComplex}, "cmplx", true},
|
2019-08-15 02:32:32 +08:00
|
|
|
{{"dcmplx",
|
|
|
|
{{"x", AnyIntOrReal, Rank::elementalOrBOZ},
|
|
|
|
{"y", AnyIntOrReal, Rank::elementalOrBOZ, Optionality::optional}},
|
|
|
|
DoublePrecisionComplex},
|
2019-09-17 00:34:10 +08:00
|
|
|
"cmplx", true},
|
|
|
|
{{"dreal", {{"a", AnyComplex}}, DoublePrecision}, "real", true},
|
2019-06-22 05:04:40 +08:00
|
|
|
{{"dconjg", {{"a", DoublePrecisionComplex}}, DoublePrecisionComplex},
|
|
|
|
"conjg"},
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"dcos", {{"x", DoublePrecision}}, DoublePrecision}, "cos"},
|
|
|
|
{{"dcosh", {{"x", DoublePrecision}}, DoublePrecision}, "cosh"},
|
|
|
|
{{"ddim", {{"x", DoublePrecision}, {"y", DoublePrecision}},
|
|
|
|
DoublePrecision},
|
|
|
|
"dim"},
|
2019-08-15 02:32:32 +08:00
|
|
|
{{"dimag", {{"a", DoublePrecisionComplex}}, DoublePrecision}, "aimag"},
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"dexp", {{"x", DoublePrecision}}, DoublePrecision}, "exp"},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"dim", {{"x", DefaultReal}, {"y", DefaultReal}}, DefaultReal}},
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"dint", {{"a", DoublePrecision}}, DoublePrecision}, "aint"},
|
|
|
|
{{"dlog", {{"x", DoublePrecision}}, DoublePrecision}, "log"},
|
|
|
|
{{"dlog10", {{"x", DoublePrecision}}, DoublePrecision}, "log10"},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"dmax1",
|
|
|
|
{{"a1", DoublePrecision}, {"a2", DoublePrecision},
|
|
|
|
{"a3", DoublePrecision, Rank::elemental, Optionality::repeats}},
|
|
|
|
DoublePrecision},
|
2019-09-17 00:34:10 +08:00
|
|
|
"max", true, true},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"dmin1",
|
|
|
|
{{"a1", DoublePrecision}, {"a2", DoublePrecision},
|
|
|
|
{"a3", DoublePrecision, Rank::elemental, Optionality::repeats}},
|
|
|
|
DoublePrecision},
|
2019-09-17 00:34:10 +08:00
|
|
|
"min", true, true},
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"dmod", {{"a", DoublePrecision}, {"p", DoublePrecision}},
|
|
|
|
DoublePrecision},
|
|
|
|
"mod"},
|
|
|
|
{{"dnint", {{"a", DoublePrecision}}, DoublePrecision}, "anint"},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"dprod", {{"x", DefaultReal}, {"y", DefaultReal}}, DoublePrecision}},
|
2018-10-05 04:43:33 +08:00
|
|
|
{{"dsign", {{"a", DoublePrecision}, {"b", DoublePrecision}},
|
|
|
|
DoublePrecision},
|
|
|
|
"sign"},
|
|
|
|
{{"dsin", {{"x", DoublePrecision}}, DoublePrecision}, "sin"},
|
|
|
|
{{"dsinh", {{"x", DoublePrecision}}, DoublePrecision}, "sinh"},
|
|
|
|
{{"dsqrt", {{"x", DoublePrecision}}, DoublePrecision}, "sqrt"},
|
|
|
|
{{"dtan", {{"x", DoublePrecision}}, DoublePrecision}, "tan"},
|
|
|
|
{{"dtanh", {{"x", DoublePrecision}}, DoublePrecision}, "tanh"},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"exp", {{"x", DefaultReal}}, DefaultReal}},
|
2019-09-17 00:34:10 +08:00
|
|
|
{{"float", {{"i", AnyInt}}, DefaultReal}, "real", true},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"iabs", {{"a", DefaultInt}}, DefaultInt}, "abs"},
|
|
|
|
{{"idim", {{"x", DefaultInt}, {"y", DefaultInt}}, DefaultInt}, "dim"},
|
2019-09-17 00:34:10 +08:00
|
|
|
{{"idint", {{"a", AnyReal}}, DefaultInt}, "int", true},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"idnint", {{"a", DoublePrecision}}, DefaultInt}, "nint"},
|
2019-09-17 00:34:10 +08:00
|
|
|
{{"ifix", {{"a", AnyReal}}, DefaultInt}, "int", true},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"index", {{"string", DefaultChar}, {"substring", DefaultChar}},
|
2020-01-04 08:32:23 +08:00
|
|
|
DefaultInt}},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"isign", {{"a", DefaultInt}, {"b", DefaultInt}}, DefaultInt}, "sign"},
|
2020-01-04 08:32:23 +08:00
|
|
|
{{"len", {{"string", DefaultChar, Rank::anyOrAssumedRank}}, DefaultInt,
|
2019-06-05 01:50:34 +08:00
|
|
|
Rank::scalar}},
|
2019-06-06 06:40:59 +08:00
|
|
|
{{"lge", {{"string_a", DefaultChar}, {"string_b", DefaultChar}},
|
|
|
|
DefaultLogical}},
|
|
|
|
{{"lgt", {{"string_a", DefaultChar}, {"string_b", DefaultChar}},
|
|
|
|
DefaultLogical}},
|
|
|
|
{{"lle", {{"string_a", DefaultChar}, {"string_b", DefaultChar}},
|
|
|
|
DefaultLogical}},
|
|
|
|
{{"llt", {{"string_a", DefaultChar}, {"string_b", DefaultChar}},
|
|
|
|
DefaultLogical}},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"log", {{"x", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"log10", {{"x", DefaultReal}}, DefaultReal}},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"max0",
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"a1", DefaultInt}, {"a2", DefaultInt},
|
|
|
|
{"a3", DefaultInt, Rank::elemental, Optionality::repeats}},
|
|
|
|
DefaultInt},
|
2019-06-06 06:40:59 +08:00
|
|
|
"max", true, true},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"max1",
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"a1", DefaultReal}, {"a2", DefaultReal},
|
|
|
|
{"a3", DefaultReal, Rank::elemental, Optionality::repeats}},
|
|
|
|
DefaultInt},
|
2019-06-06 06:40:59 +08:00
|
|
|
"max", true, true},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"min0",
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"a1", DefaultInt}, {"a2", DefaultInt},
|
|
|
|
{"a3", DefaultInt, Rank::elemental, Optionality::repeats}},
|
|
|
|
DefaultInt},
|
2019-06-06 06:40:59 +08:00
|
|
|
"min", true, true},
|
2018-10-12 05:51:14 +08:00
|
|
|
{{"min1",
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"a1", DefaultReal}, {"a2", DefaultReal},
|
|
|
|
{"a3", DefaultReal, Rank::elemental, Optionality::repeats}},
|
|
|
|
DefaultInt},
|
2019-06-06 06:40:59 +08:00
|
|
|
"min", true, true},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"mod", {{"a", DefaultInt}, {"p", DefaultInt}}, DefaultInt}},
|
|
|
|
{{"nint", {{"a", DefaultReal}}, DefaultInt}},
|
|
|
|
{{"sign", {{"a", DefaultReal}, {"b", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"sin", {{"x", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"sinh", {{"x", DefaultReal}}, DefaultReal}},
|
2019-09-17 00:34:10 +08:00
|
|
|
{{"sngl", {{"a", AnyReal}}, DefaultReal}, "real", true},
|
2018-10-17 05:42:22 +08:00
|
|
|
{{"sqrt", {{"x", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"tan", {{"x", DefaultReal}}, DefaultReal}},
|
|
|
|
{{"tanh", {{"x", DefaultReal}}, DefaultReal}},
|
2018-09-29 08:02:11 +08:00
|
|
|
};
|
|
|
|
|
2019-09-17 07:58:13 +08:00
|
|
|
static const IntrinsicInterface intrinsicSubroutine[]{
|
2020-10-20 18:39:26 +08:00
|
|
|
{"cpu_time",
|
|
|
|
{{"time", AnyReal, Rank::scalar, Optionality::required,
|
|
|
|
common::Intent::Out}},
|
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"date_and_time",
|
2020-10-20 18:39:26 +08:00
|
|
|
{{"date", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"time", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"zone", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"values", AnyInt, Rank::vector, Optionality::optional,
|
|
|
|
common::Intent::Out}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"execute_command_line",
|
|
|
|
{{"command", DefaultChar, Rank::scalar},
|
|
|
|
{"wait", AnyLogical, Rank::scalar, Optionality::optional},
|
2020-10-20 18:39:26 +08:00
|
|
|
{"exitstat", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::InOut},
|
|
|
|
{"cmdstat", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"cmdmsg", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::InOut}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"get_command",
|
2020-10-20 18:39:26 +08:00
|
|
|
{{"command", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"length", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"status", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"errmsg", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::InOut}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"get_command_argument",
|
|
|
|
{{"number", AnyInt, Rank::scalar},
|
2020-10-20 18:39:26 +08:00
|
|
|
{"value", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"length", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"status", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"errmsg", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::InOut}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"get_environment_variable",
|
|
|
|
{{"name", DefaultChar, Rank::scalar},
|
2020-10-20 18:39:26 +08:00
|
|
|
{"value", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"length", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"status", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"trim_name", AnyLogical, Rank::scalar, Optionality::optional},
|
2020-10-20 18:39:26 +08:00
|
|
|
{"errmsg", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::InOut}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"move_alloc",
|
2020-10-20 18:39:26 +08:00
|
|
|
{{"from", SameType, Rank::known, Optionality::required,
|
|
|
|
common::Intent::InOut},
|
|
|
|
{"to", SameType, Rank::known, Optionality::required,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"stat", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"errmsg", DefaultChar, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::InOut}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::pureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"mvbits",
|
|
|
|
{{"from", SameInt}, {"frompos", AnyInt}, {"len", AnyInt},
|
2020-10-20 18:39:26 +08:00
|
|
|
{"to", SameInt, Rank::elemental, Optionality::required,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"topos", AnyInt}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::elementalSubroutine}, // elemental
|
2019-09-17 07:58:13 +08:00
|
|
|
{"random_init",
|
|
|
|
{{"repeatable", AnyLogical, Rank::scalar},
|
|
|
|
{"image_distinct", AnyLogical, Rank::scalar}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2020-10-20 18:39:26 +08:00
|
|
|
{"random_number",
|
|
|
|
{{"harvest", AnyReal, Rank::known, Optionality::required,
|
|
|
|
common::Intent::Out}},
|
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"random_seed",
|
2020-10-20 18:39:26 +08:00
|
|
|
{{"size", DefaultInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
2019-09-17 07:58:13 +08:00
|
|
|
{"put", DefaultInt, Rank::vector, Optionality::optional},
|
2020-10-20 18:39:26 +08:00
|
|
|
{"get", DefaultInt, Rank::vector, Optionality::optional,
|
|
|
|
common::Intent::Out}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental,
|
|
|
|
IntrinsicClass::impureSubroutine}, // TODO: at most one argument can be
|
|
|
|
// present
|
2019-09-17 07:58:13 +08:00
|
|
|
{"system_clock",
|
2020-10-20 18:39:26 +08:00
|
|
|
{{"count", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"count_rate", AnyIntOrReal, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out},
|
|
|
|
{"count_max", AnyInt, Rank::scalar, Optionality::optional,
|
|
|
|
common::Intent::Out}},
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
|
2019-09-17 07:58:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: Intrinsic subroutine EVENT_QUERY
|
2018-10-12 05:51:14 +08:00
|
|
|
// TODO: Atomic intrinsic subroutines: ATOMIC_ADD &al.
|
|
|
|
// TODO: Collective intrinsic subroutines: CO_BROADCAST &al.
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// Intrinsic interface matching against the arguments of a particular
|
|
|
|
// procedure reference.
|
2018-10-18 06:09:48 +08:00
|
|
|
std::optional<SpecificCall> IntrinsicInterface::Match(
|
2018-10-16 06:28:47 +08:00
|
|
|
const CallCharacteristics &call,
|
2019-01-19 04:40:47 +08:00
|
|
|
const common::IntrinsicTypeDefaultKinds &defaults,
|
2019-04-19 05:11:15 +08:00
|
|
|
ActualArguments &arguments, FoldingContext &context) const {
|
|
|
|
auto &messages{context.messages()};
|
2018-10-05 04:43:33 +08:00
|
|
|
// Attempt to construct a 1-1 correspondence between the dummy arguments in
|
|
|
|
// a particular intrinsic procedure's generic interface and the actual
|
|
|
|
// arguments in a procedure reference.
|
2018-10-19 01:50:55 +08:00
|
|
|
std::size_t dummyArgPatterns{0};
|
2019-11-10 01:29:31 +08:00
|
|
|
for (; dummyArgPatterns < maxArguments && dummy[dummyArgPatterns].keyword;
|
2018-10-19 01:50:55 +08:00
|
|
|
++dummyArgPatterns) {
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
2018-10-19 01:50:55 +08:00
|
|
|
// MAX and MIN (and others that map to them) allow their last argument to
|
|
|
|
// be repeated indefinitely. The actualForDummy vector is sized
|
|
|
|
// and null-initialized to the non-repeated dummy argument count,
|
|
|
|
// but additional actual argument pointers can be pushed on it
|
|
|
|
// when this flag is set.
|
|
|
|
bool repeatLastDummy{dummyArgPatterns > 0 &&
|
|
|
|
dummy[dummyArgPatterns - 1].optionality == Optionality::repeats};
|
2019-10-31 23:03:16 +08:00
|
|
|
std::size_t nonRepeatedDummies{
|
|
|
|
repeatLastDummy ? dummyArgPatterns - 1 : dummyArgPatterns};
|
|
|
|
std::vector<ActualArgument *> actualForDummy(nonRepeatedDummies, nullptr);
|
2018-10-19 01:50:55 +08:00
|
|
|
int missingActualArguments{0};
|
2018-10-18 06:09:48 +08:00
|
|
|
for (std::optional<ActualArgument> &arg : arguments) {
|
2019-11-10 01:29:31 +08:00
|
|
|
if (!arg) {
|
2018-10-19 01:50:55 +08:00
|
|
|
++missingActualArguments;
|
|
|
|
} else {
|
2019-12-06 02:24:18 +08:00
|
|
|
if (arg->isAlternateReturn()) {
|
2018-10-18 06:09:48 +08:00
|
|
|
messages.Say(
|
|
|
|
"alternate return specifier not acceptable on call to intrinsic '%s'"_err_en_US,
|
|
|
|
name);
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
bool found{false};
|
2018-10-19 01:50:55 +08:00
|
|
|
int slot{missingActualArguments};
|
2019-10-31 23:03:16 +08:00
|
|
|
for (std::size_t j{0}; j < nonRepeatedDummies && !found; ++j) {
|
2021-01-15 04:54:31 +08:00
|
|
|
if (dummy[j].optionality == Optionality::missing) {
|
|
|
|
continue;
|
|
|
|
}
|
2019-12-06 02:24:18 +08:00
|
|
|
if (arg->keyword()) {
|
|
|
|
found = *arg->keyword() == dummy[j].keyword;
|
2018-10-19 01:50:55 +08:00
|
|
|
if (found) {
|
|
|
|
if (const auto *previous{actualForDummy[j]}) {
|
2019-12-06 02:24:18 +08:00
|
|
|
if (previous->keyword()) {
|
|
|
|
messages.Say(*arg->keyword(),
|
2018-10-19 01:50:55 +08:00
|
|
|
"repeated keyword argument to intrinsic '%s'"_err_en_US,
|
|
|
|
name);
|
|
|
|
} else {
|
2019-12-06 02:24:18 +08:00
|
|
|
messages.Say(*arg->keyword(),
|
2018-10-19 01:50:55 +08:00
|
|
|
"keyword argument to intrinsic '%s' was supplied "
|
|
|
|
"positionally by an earlier actual argument"_err_en_US,
|
|
|
|
name);
|
|
|
|
}
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
2018-10-18 06:09:48 +08:00
|
|
|
}
|
2018-10-19 01:50:55 +08:00
|
|
|
} else {
|
2019-11-10 01:29:31 +08:00
|
|
|
found = !actualForDummy[j] && slot-- == 0;
|
2018-10-19 01:50:55 +08:00
|
|
|
}
|
|
|
|
if (found) {
|
|
|
|
actualForDummy[j] = &*arg;
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
|
|
|
}
|
2018-10-18 06:09:48 +08:00
|
|
|
if (!found) {
|
2019-12-06 02:24:18 +08:00
|
|
|
if (repeatLastDummy && !arg->keyword()) {
|
2018-10-19 01:50:55 +08:00
|
|
|
// MAX/MIN argument after the 2nd
|
|
|
|
actualForDummy.push_back(&*arg);
|
2018-10-18 06:09:48 +08:00
|
|
|
} else {
|
2019-12-06 02:24:18 +08:00
|
|
|
if (arg->keyword()) {
|
|
|
|
messages.Say(*arg->keyword(),
|
2018-10-19 01:50:55 +08:00
|
|
|
"unknown keyword argument to intrinsic '%s'"_err_en_US, name);
|
|
|
|
} else {
|
|
|
|
messages.Say(
|
|
|
|
"too many actual arguments for intrinsic '%s'"_err_en_US, name);
|
|
|
|
}
|
|
|
|
return std::nullopt;
|
2018-10-18 06:09:48 +08:00
|
|
|
}
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-19 01:50:55 +08:00
|
|
|
std::size_t dummies{actualForDummy.size()};
|
|
|
|
|
2018-10-05 04:43:33 +08:00
|
|
|
// Check types and kinds of the actual arguments against the intrinsic's
|
|
|
|
// interface. Ensure that two or more arguments that have to have the same
|
2019-07-18 03:51:52 +08:00
|
|
|
// (or compatible) type and kind do so. Check for missing non-optional
|
|
|
|
// arguments now, too.
|
2018-10-09 06:35:19 +08:00
|
|
|
const ActualArgument *sameArg{nullptr};
|
2019-07-18 03:51:52 +08:00
|
|
|
const ActualArgument *operandArg{nullptr};
|
2018-10-05 04:43:33 +08:00
|
|
|
const IntrinsicDummyArgument *kindDummyArg{nullptr};
|
2018-10-09 06:35:19 +08:00
|
|
|
const ActualArgument *kindArg{nullptr};
|
2018-10-05 04:43:33 +08:00
|
|
|
bool hasDimArg{false};
|
2018-10-19 01:50:55 +08:00
|
|
|
for (std::size_t j{0}; j < dummies; ++j) {
|
|
|
|
const IntrinsicDummyArgument &d{dummy[std::min(j, dummyArgPatterns - 1)]};
|
2018-10-05 04:43:33 +08:00
|
|
|
if (d.typePattern.kindCode == KindCode::kindArg) {
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(!kindDummyArg);
|
2018-10-05 04:43:33 +08:00
|
|
|
kindDummyArg = &d;
|
|
|
|
}
|
2018-10-19 01:50:55 +08:00
|
|
|
const ActualArgument *arg{actualForDummy[j]};
|
2018-10-05 04:43:33 +08:00
|
|
|
if (!arg) {
|
2018-10-06 02:32:54 +08:00
|
|
|
if (d.optionality == Optionality::required) {
|
2018-10-13 07:01:55 +08:00
|
|
|
messages.Say("missing mandatory '%s=' argument"_err_en_US, d.keyword);
|
2020-03-29 12:00:16 +08:00
|
|
|
return std::nullopt; // missing non-OPTIONAL argument
|
2018-10-06 02:32:54 +08:00
|
|
|
} else {
|
|
|
|
continue;
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
2021-01-15 04:54:31 +08:00
|
|
|
} else if (d.optionality == Optionality::missing) {
|
|
|
|
messages.Say("unexpected '%s=' argument"_err_en_US, d.keyword);
|
|
|
|
return std::nullopt;
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
2019-04-19 05:11:15 +08:00
|
|
|
if (arg->GetAssumedTypeDummy()) {
|
|
|
|
// TYPE(*) assumed-type dummy argument forwarded to intrinsic
|
|
|
|
if (d.typePattern.categorySet == AnyType &&
|
2019-08-13 01:56:18 +08:00
|
|
|
d.rank == Rank::anyOrAssumedRank &&
|
|
|
|
(d.typePattern.kindCode == KindCode::any ||
|
|
|
|
d.typePattern.kindCode == KindCode::addressable)) {
|
2019-04-19 05:11:15 +08:00
|
|
|
continue;
|
2019-05-04 02:29:15 +08:00
|
|
|
} else {
|
|
|
|
messages.Say("Assumed type TYPE(*) dummy argument not allowed "
|
|
|
|
"for '%s=' intrinsic argument"_err_en_US,
|
|
|
|
d.keyword);
|
|
|
|
return std::nullopt;
|
2019-04-19 05:11:15 +08:00
|
|
|
}
|
|
|
|
}
|
2018-10-09 06:35:19 +08:00
|
|
|
std::optional<DynamicType> type{arg->GetType()};
|
2019-11-10 01:29:31 +08:00
|
|
|
if (!type) {
|
2018-10-09 06:35:19 +08:00
|
|
|
CHECK(arg->Rank() == 0);
|
2020-03-14 03:19:44 +08:00
|
|
|
const Expr<SomeType> &expr{DEREF(arg->UnwrapExpr())};
|
|
|
|
if (std::holds_alternative<BOZLiteralConstant>(expr.u)) {
|
2019-05-04 02:29:15 +08:00
|
|
|
if (d.typePattern.kindCode == KindCode::typeless ||
|
|
|
|
d.rank == Rank::elementalOrBOZ) {
|
|
|
|
continue;
|
|
|
|
} else {
|
2020-07-24 16:19:29 +08:00
|
|
|
const IntrinsicDummyArgument &nextParam{dummy[j + 1]};
|
2019-05-04 02:29:15 +08:00
|
|
|
messages.Say(
|
2020-07-24 16:19:29 +08:00
|
|
|
"Typeless (BOZ) not allowed for both '%s=' & '%s=' arguments"_err_en_US, // C7109
|
|
|
|
d.keyword, nextParam.keyword);
|
2019-05-04 02:29:15 +08:00
|
|
|
}
|
|
|
|
} else {
|
2020-03-14 03:19:44 +08:00
|
|
|
// NULL(), procedure, or procedure pointer
|
|
|
|
CHECK(IsProcedurePointer(expr));
|
|
|
|
if (d.typePattern.kindCode == KindCode::addressable ||
|
|
|
|
d.rank == Rank::reduceOperation) {
|
2019-08-13 01:56:18 +08:00
|
|
|
continue;
|
2020-09-26 00:03:17 +08:00
|
|
|
} else if (d.typePattern.kindCode == KindCode::nullPointerType) {
|
|
|
|
continue;
|
2019-08-13 01:56:18 +08:00
|
|
|
} else {
|
2020-03-14 03:19:44 +08:00
|
|
|
messages.Say(
|
|
|
|
"Actual argument for '%s=' may not be a procedure"_err_en_US,
|
2019-07-02 07:54:53 +08:00
|
|
|
d.keyword);
|
|
|
|
}
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
2018-10-06 02:32:54 +08:00
|
|
|
return std::nullopt;
|
2019-05-14 00:33:18 +08:00
|
|
|
} else if (!d.typePattern.categorySet.test(type->category())) {
|
2019-05-04 02:29:15 +08:00
|
|
|
messages.Say("Actual argument for '%s=' has bad type '%s'"_err_en_US,
|
2019-05-07 00:33:45 +08:00
|
|
|
d.keyword, type->AsFortran());
|
2020-03-29 12:00:16 +08:00
|
|
|
return std::nullopt; // argument has invalid type category
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
|
|
|
bool argOk{false};
|
|
|
|
switch (d.typePattern.kindCode) {
|
|
|
|
case KindCode::none:
|
|
|
|
case KindCode::typeless:
|
2020-03-29 12:00:16 +08:00
|
|
|
case KindCode::teamType: // TODO: TEAM_TYPE
|
2018-10-05 04:43:33 +08:00
|
|
|
argOk = false;
|
|
|
|
break;
|
|
|
|
case KindCode::defaultIntegerKind:
|
2019-05-14 00:33:18 +08:00
|
|
|
argOk = type->kind() == defaults.GetDefaultKind(TypeCategory::Integer);
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
|
|
|
case KindCode::defaultRealKind:
|
2019-05-14 00:33:18 +08:00
|
|
|
argOk = type->kind() == defaults.GetDefaultKind(TypeCategory::Real);
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
|
|
|
case KindCode::doublePrecision:
|
2019-05-14 00:33:18 +08:00
|
|
|
argOk = type->kind() == defaults.doublePrecisionKind();
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
|
|
|
case KindCode::defaultCharKind:
|
2019-05-14 00:33:18 +08:00
|
|
|
argOk = type->kind() == defaults.GetDefaultKind(TypeCategory::Character);
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
|
|
|
case KindCode::defaultLogicalKind:
|
2019-05-14 00:33:18 +08:00
|
|
|
argOk = type->kind() == defaults.GetDefaultKind(TypeCategory::Logical);
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2020-03-29 12:00:16 +08:00
|
|
|
case KindCode::any:
|
|
|
|
argOk = true;
|
|
|
|
break;
|
2018-10-05 04:43:33 +08:00
|
|
|
case KindCode::kindArg:
|
2019-05-14 00:33:18 +08:00
|
|
|
CHECK(type->category() == TypeCategory::Integer);
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(!kindArg);
|
2018-10-05 04:43:33 +08:00
|
|
|
kindArg = arg;
|
2018-10-10 03:07:29 +08:00
|
|
|
argOk = true;
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
|
|
|
case KindCode::dimArg:
|
2019-05-14 00:33:18 +08:00
|
|
|
CHECK(type->category() == TypeCategory::Integer);
|
2018-10-05 04:43:33 +08:00
|
|
|
hasDimArg = true;
|
|
|
|
argOk = true;
|
|
|
|
break;
|
|
|
|
case KindCode::same:
|
2019-11-10 01:29:31 +08:00
|
|
|
if (!sameArg) {
|
2018-10-05 04:43:33 +08:00
|
|
|
sameArg = arg;
|
|
|
|
}
|
2019-07-04 03:19:35 +08:00
|
|
|
argOk = type->IsTkCompatibleWith(sameArg->GetType().value());
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2019-07-18 03:51:52 +08:00
|
|
|
case KindCode::operand:
|
2019-11-10 01:29:31 +08:00
|
|
|
if (!operandArg) {
|
2019-07-18 03:51:52 +08:00
|
|
|
operandArg = arg;
|
|
|
|
} else if (auto prev{operandArg->GetType()}) {
|
|
|
|
if (type->category() == prev->category()) {
|
|
|
|
if (type->kind() > prev->kind()) {
|
|
|
|
operandArg = arg;
|
|
|
|
}
|
|
|
|
} else if (prev->category() == TypeCategory::Integer) {
|
|
|
|
operandArg = arg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
argOk = true;
|
|
|
|
break;
|
2018-10-05 04:43:33 +08:00
|
|
|
case KindCode::effectiveKind:
|
|
|
|
common::die("INTERNAL: KindCode::effectiveKind appears on argument '%s' "
|
|
|
|
"for intrinsic '%s'",
|
|
|
|
d.keyword, name);
|
|
|
|
break;
|
2020-03-29 12:00:16 +08:00
|
|
|
case KindCode::addressable:
|
2020-09-26 00:03:17 +08:00
|
|
|
case KindCode::nullPointerType:
|
2020-03-29 12:00:16 +08:00
|
|
|
argOk = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
CRASH_NO_CASE;
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
|
|
|
if (!argOk) {
|
2018-10-06 02:32:54 +08:00
|
|
|
messages.Say(
|
2019-06-05 01:50:34 +08:00
|
|
|
"Actual argument for '%s=' has bad type or kind '%s'"_err_en_US,
|
2019-05-07 00:33:45 +08:00
|
|
|
d.keyword, type->AsFortran());
|
2018-10-05 04:43:33 +08:00
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check the ranks of the arguments against the intrinsic's interface.
|
2018-10-09 06:35:19 +08:00
|
|
|
const ActualArgument *arrayArg{nullptr};
|
|
|
|
const ActualArgument *knownArg{nullptr};
|
2019-04-04 07:04:13 +08:00
|
|
|
std::optional<int> shapeArgSize;
|
2018-10-05 04:43:33 +08:00
|
|
|
int elementalRank{0};
|
2018-10-19 01:50:55 +08:00
|
|
|
for (std::size_t j{0}; j < dummies; ++j) {
|
|
|
|
const IntrinsicDummyArgument &d{dummy[std::min(j, dummyArgPatterns - 1)]};
|
|
|
|
if (const ActualArgument * arg{actualForDummy[j]}) {
|
2019-04-19 05:11:15 +08:00
|
|
|
if (IsAssumedRank(*arg) && d.rank != Rank::anyOrAssumedRank) {
|
2019-06-05 01:50:34 +08:00
|
|
|
messages.Say("Assumed-rank array cannot be forwarded to "
|
2018-10-30 06:25:35 +08:00
|
|
|
"'%s=' argument"_err_en_US,
|
2018-10-06 02:32:54 +08:00
|
|
|
d.keyword);
|
2018-10-05 04:43:33 +08:00
|
|
|
return std::nullopt;
|
|
|
|
}
|
2018-10-09 06:35:19 +08:00
|
|
|
int rank{arg->Rank()};
|
2018-10-05 04:43:33 +08:00
|
|
|
bool argOk{false};
|
|
|
|
switch (d.rank) {
|
|
|
|
case Rank::elemental:
|
2018-10-06 02:32:54 +08:00
|
|
|
case Rank::elementalOrBOZ:
|
2018-10-05 04:43:33 +08:00
|
|
|
if (elementalRank == 0) {
|
2018-10-09 06:35:19 +08:00
|
|
|
elementalRank = rank;
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
2018-10-09 06:35:19 +08:00
|
|
|
argOk = rank == 0 || rank == elementalRank;
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2020-03-29 12:00:16 +08:00
|
|
|
case Rank::scalar:
|
|
|
|
argOk = rank == 0;
|
|
|
|
break;
|
|
|
|
case Rank::vector:
|
|
|
|
argOk = rank == 1;
|
|
|
|
break;
|
2018-10-05 04:43:33 +08:00
|
|
|
case Rank::shape:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(!shapeArgSize);
|
2020-07-30 05:46:36 +08:00
|
|
|
if (rank != 1) {
|
|
|
|
messages.Say(
|
|
|
|
"'shape=' argument must be an array of rank 1"_err_en_US);
|
|
|
|
return std::nullopt;
|
|
|
|
} else {
|
2019-04-19 05:11:15 +08:00
|
|
|
if (auto shape{GetShape(context, *arg)}) {
|
2019-10-09 06:21:09 +08:00
|
|
|
if (auto constShape{AsConstantShape(context, *shape)}) {
|
2019-05-14 00:33:18 +08:00
|
|
|
shapeArgSize = constShape->At(ConstantSubscripts{1}).ToInt64();
|
2019-04-05 04:58:46 +08:00
|
|
|
CHECK(shapeArgSize >= 0);
|
|
|
|
argOk = true;
|
2019-04-04 07:04:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!argOk) {
|
|
|
|
messages.Say(
|
|
|
|
"'shape=' argument must be a vector of known size"_err_en_US);
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2020-03-29 12:00:16 +08:00
|
|
|
case Rank::matrix:
|
|
|
|
argOk = rank == 2;
|
|
|
|
break;
|
2018-10-05 04:43:33 +08:00
|
|
|
case Rank::array:
|
2018-10-09 06:35:19 +08:00
|
|
|
argOk = rank > 0;
|
2018-10-05 04:43:33 +08:00
|
|
|
if (!arrayArg) {
|
|
|
|
arrayArg = arg;
|
|
|
|
} else {
|
2018-10-09 06:35:19 +08:00
|
|
|
argOk &= rank == arrayArg->Rank();
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Rank::known:
|
2019-11-10 01:29:31 +08:00
|
|
|
if (!knownArg) {
|
2019-07-16 01:12:46 +08:00
|
|
|
knownArg = arg;
|
|
|
|
}
|
|
|
|
argOk = rank == knownArg->Rank();
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2020-03-29 12:00:16 +08:00
|
|
|
case Rank::anyOrAssumedRank:
|
|
|
|
argOk = true;
|
|
|
|
break;
|
2018-10-05 04:43:33 +08:00
|
|
|
case Rank::conformable:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(arrayArg);
|
2018-10-09 06:35:19 +08:00
|
|
|
argOk = rank == 0 || rank == arrayArg->Rank();
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2021-01-15 04:54:31 +08:00
|
|
|
case Rank::dimReduced:
|
|
|
|
case Rank::dimRemovedOrScalar:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(arrayArg);
|
2020-01-15 02:53:36 +08:00
|
|
|
argOk = rank == 0 || rank + 1 == arrayArg->Rank();
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2018-10-12 05:51:14 +08:00
|
|
|
case Rank::reduceOperation:
|
2020-03-14 03:19:44 +08:00
|
|
|
// TODO: validate the reduction operation -- it must be a pure
|
|
|
|
// function of two arguments with special constraints.
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(arrayArg);
|
2018-10-12 05:51:14 +08:00
|
|
|
argOk = rank == 0;
|
|
|
|
break;
|
2021-01-15 04:54:31 +08:00
|
|
|
case Rank::locReduced:
|
2018-10-05 04:43:33 +08:00
|
|
|
case Rank::rankPlus1:
|
|
|
|
case Rank::shaped:
|
|
|
|
common::die("INTERNAL: result-only rank code appears on argument '%s' "
|
|
|
|
"for intrinsic '%s'",
|
|
|
|
d.keyword, name);
|
|
|
|
}
|
|
|
|
if (!argOk) {
|
2018-10-13 07:01:55 +08:00
|
|
|
messages.Say("'%s=' argument has unacceptable rank %d"_err_en_US,
|
2018-10-09 06:35:19 +08:00
|
|
|
d.keyword, rank);
|
2018-10-05 04:43:33 +08:00
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate the characteristics of the function result, if any
|
2018-10-18 06:09:48 +08:00
|
|
|
std::optional<DynamicType> resultType;
|
2019-05-04 02:29:15 +08:00
|
|
|
if (auto category{result.categorySet.LeastElement()}) {
|
|
|
|
// The intrinsic is not a subroutine.
|
2018-10-18 06:09:48 +08:00
|
|
|
if (call.isSubroutineCall) {
|
|
|
|
return std::nullopt;
|
2018-10-13 07:25:39 +08:00
|
|
|
}
|
2018-10-18 06:09:48 +08:00
|
|
|
switch (result.kindCode) {
|
|
|
|
case KindCode::defaultIntegerKind:
|
|
|
|
CHECK(result.categorySet == IntType);
|
2019-05-04 02:29:15 +08:00
|
|
|
CHECK(*category == TypeCategory::Integer);
|
|
|
|
resultType = DynamicType{TypeCategory::Integer,
|
|
|
|
defaults.GetDefaultKind(TypeCategory::Integer)};
|
2018-10-18 06:09:48 +08:00
|
|
|
break;
|
|
|
|
case KindCode::defaultRealKind:
|
2019-05-04 02:29:15 +08:00
|
|
|
CHECK(result.categorySet == CategorySet{*category});
|
|
|
|
CHECK(FloatingType.test(*category));
|
|
|
|
resultType =
|
|
|
|
DynamicType{*category, defaults.GetDefaultKind(TypeCategory::Real)};
|
2018-10-18 06:09:48 +08:00
|
|
|
break;
|
|
|
|
case KindCode::doublePrecision:
|
2019-08-23 20:37:37 +08:00
|
|
|
CHECK(result.categorySet == CategorySet{*category});
|
|
|
|
CHECK(FloatingType.test(*category));
|
|
|
|
resultType = DynamicType{*category, defaults.doublePrecisionKind()};
|
2018-10-18 06:09:48 +08:00
|
|
|
break;
|
|
|
|
case KindCode::defaultCharKind:
|
|
|
|
CHECK(result.categorySet == CharType);
|
2019-05-04 02:29:15 +08:00
|
|
|
CHECK(*category == TypeCategory::Character);
|
|
|
|
resultType = DynamicType{TypeCategory::Character,
|
|
|
|
defaults.GetDefaultKind(TypeCategory::Character)};
|
2018-10-18 06:09:48 +08:00
|
|
|
break;
|
|
|
|
case KindCode::defaultLogicalKind:
|
|
|
|
CHECK(result.categorySet == LogicalType);
|
2019-05-04 02:29:15 +08:00
|
|
|
CHECK(*category == TypeCategory::Logical);
|
|
|
|
resultType = DynamicType{TypeCategory::Logical,
|
|
|
|
defaults.GetDefaultKind(TypeCategory::Logical)};
|
2018-10-18 06:09:48 +08:00
|
|
|
break;
|
|
|
|
case KindCode::same:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(sameArg);
|
2018-10-18 06:09:48 +08:00
|
|
|
if (std::optional<DynamicType> aType{sameArg->GetType()}) {
|
2019-05-14 00:33:18 +08:00
|
|
|
if (result.categorySet.test(aType->category())) {
|
2018-10-18 06:09:48 +08:00
|
|
|
resultType = *aType;
|
|
|
|
} else {
|
2019-05-14 00:33:18 +08:00
|
|
|
resultType = DynamicType{*category, aType->kind()};
|
2018-10-18 06:09:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-07-18 03:51:52 +08:00
|
|
|
case KindCode::operand:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(operandArg);
|
2019-07-20 01:37:55 +08:00
|
|
|
resultType = operandArg->GetType();
|
|
|
|
CHECK(!resultType || result.categorySet.test(resultType->category()));
|
2019-07-18 03:51:52 +08:00
|
|
|
break;
|
2018-10-18 06:09:48 +08:00
|
|
|
case KindCode::effectiveKind:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(kindDummyArg);
|
2019-05-04 02:29:15 +08:00
|
|
|
CHECK(result.categorySet == CategorySet{*category});
|
2019-11-10 01:29:31 +08:00
|
|
|
if (kindArg) {
|
2019-05-22 07:58:46 +08:00
|
|
|
if (auto *expr{kindArg->UnwrapExpr()}) {
|
2019-04-19 05:11:15 +08:00
|
|
|
CHECK(expr->Rank() == 0);
|
|
|
|
if (auto code{ToInt64(*expr)}) {
|
2019-05-04 02:29:15 +08:00
|
|
|
if (IsValidKindOfIntrinsicType(*category, *code)) {
|
|
|
|
resultType = DynamicType{*category, static_cast<int>(*code)};
|
2019-04-19 05:11:15 +08:00
|
|
|
break;
|
|
|
|
}
|
2018-10-10 03:07:29 +08:00
|
|
|
}
|
|
|
|
}
|
2018-10-18 06:09:48 +08:00
|
|
|
messages.Say("'kind=' argument must be a constant scalar integer "
|
|
|
|
"whose value is a supported kind for the "
|
|
|
|
"intrinsic result type"_err_en_US);
|
|
|
|
return std::nullopt;
|
|
|
|
} else if (kindDummyArg->optionality == Optionality::defaultsToSameKind) {
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(sameArg);
|
2018-10-18 06:09:48 +08:00
|
|
|
resultType = *sameArg->GetType();
|
2020-01-04 08:32:23 +08:00
|
|
|
} else if (kindDummyArg->optionality == Optionality::defaultsToSizeKind) {
|
2019-05-04 02:29:15 +08:00
|
|
|
CHECK(*category == TypeCategory::Integer);
|
|
|
|
resultType =
|
2020-01-04 08:32:23 +08:00
|
|
|
DynamicType{TypeCategory::Integer, defaults.sizeIntegerKind()};
|
2018-10-18 06:09:48 +08:00
|
|
|
} else {
|
|
|
|
CHECK(kindDummyArg->optionality ==
|
|
|
|
Optionality::defaultsToDefaultForResult);
|
2019-05-04 02:29:15 +08:00
|
|
|
resultType = DynamicType{*category, defaults.GetDefaultKind(*category)};
|
2018-10-10 03:07:29 +08:00
|
|
|
}
|
2018-10-18 06:09:48 +08:00
|
|
|
break;
|
|
|
|
case KindCode::likeMultiply:
|
|
|
|
CHECK(dummies >= 2);
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(actualForDummy[0]);
|
|
|
|
CHECK(actualForDummy[1]);
|
2018-10-18 06:09:48 +08:00
|
|
|
resultType = actualForDummy[0]->GetType()->ResultTypeForMultiply(
|
|
|
|
*actualForDummy[1]->GetType());
|
|
|
|
break;
|
2019-07-02 04:22:22 +08:00
|
|
|
case KindCode::subscript:
|
|
|
|
CHECK(result.categorySet == IntType);
|
|
|
|
CHECK(*category == TypeCategory::Integer);
|
|
|
|
resultType =
|
|
|
|
DynamicType{TypeCategory::Integer, defaults.subscriptIntegerKind()};
|
|
|
|
break;
|
2020-01-04 08:32:23 +08:00
|
|
|
case KindCode::size:
|
|
|
|
CHECK(result.categorySet == IntType);
|
|
|
|
CHECK(*category == TypeCategory::Integer);
|
|
|
|
resultType =
|
|
|
|
DynamicType{TypeCategory::Integer, defaults.sizeIntegerKind()};
|
|
|
|
break;
|
2018-10-18 06:09:48 +08:00
|
|
|
case KindCode::typeless:
|
|
|
|
case KindCode::teamType:
|
|
|
|
case KindCode::any:
|
|
|
|
case KindCode::kindArg:
|
|
|
|
case KindCode::dimArg:
|
|
|
|
common::die(
|
|
|
|
"INTERNAL: bad KindCode appears on intrinsic '%s' result", name);
|
|
|
|
break;
|
2020-03-29 12:00:16 +08:00
|
|
|
default:
|
|
|
|
CRASH_NO_CASE;
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
2019-05-04 02:29:15 +08:00
|
|
|
} else {
|
|
|
|
if (!call.isSubroutineCall) {
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
CHECK(result.kindCode == KindCode::none);
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
|
|
|
|
2018-10-10 03:07:29 +08:00
|
|
|
// At this point, the call is acceptable.
|
2018-10-05 04:43:33 +08:00
|
|
|
// Determine the rank of the function result.
|
|
|
|
int resultRank{0};
|
|
|
|
switch (rank) {
|
2020-03-29 12:00:16 +08:00
|
|
|
case Rank::elemental:
|
|
|
|
resultRank = elementalRank;
|
|
|
|
break;
|
|
|
|
case Rank::scalar:
|
|
|
|
resultRank = 0;
|
|
|
|
break;
|
|
|
|
case Rank::vector:
|
|
|
|
resultRank = 1;
|
|
|
|
break;
|
|
|
|
case Rank::matrix:
|
|
|
|
resultRank = 2;
|
|
|
|
break;
|
2018-10-10 03:07:29 +08:00
|
|
|
case Rank::conformable:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(arrayArg);
|
2018-10-10 03:07:29 +08:00
|
|
|
resultRank = arrayArg->Rank();
|
|
|
|
break;
|
2018-10-05 04:43:33 +08:00
|
|
|
case Rank::dimReduced:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(arrayArg);
|
2018-10-09 06:35:19 +08:00
|
|
|
resultRank = hasDimArg ? arrayArg->Rank() - 1 : 0;
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2021-01-15 04:54:31 +08:00
|
|
|
case Rank::locReduced:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(arrayArg);
|
2021-01-15 04:54:31 +08:00
|
|
|
resultRank = hasDimArg ? arrayArg->Rank() - 1 : 1;
|
2019-06-26 04:07:32 +08:00
|
|
|
break;
|
2018-10-05 04:43:33 +08:00
|
|
|
case Rank::rankPlus1:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(knownArg);
|
2018-10-09 06:35:19 +08:00
|
|
|
resultRank = knownArg->Rank() + 1;
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
|
|
|
case Rank::shaped:
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(shapeArgSize);
|
2019-04-04 07:04:13 +08:00
|
|
|
resultRank = *shapeArgSize;
|
2018-10-05 04:43:33 +08:00
|
|
|
break;
|
2018-10-06 02:32:54 +08:00
|
|
|
case Rank::elementalOrBOZ:
|
2018-10-05 04:43:33 +08:00
|
|
|
case Rank::shape:
|
|
|
|
case Rank::array:
|
|
|
|
case Rank::known:
|
|
|
|
case Rank::anyOrAssumedRank:
|
2018-10-12 05:51:14 +08:00
|
|
|
case Rank::reduceOperation:
|
2021-01-15 04:54:31 +08:00
|
|
|
case Rank::dimRemovedOrScalar:
|
2018-10-05 04:43:33 +08:00
|
|
|
common::die("INTERNAL: bad Rank code on intrinsic '%s' result", name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CHECK(resultRank >= 0);
|
|
|
|
|
2018-10-18 06:09:48 +08:00
|
|
|
// Rearrange the actual arguments into dummy argument order.
|
|
|
|
ActualArguments rearranged(dummies);
|
2018-10-19 01:50:55 +08:00
|
|
|
for (std::size_t j{0}; j < dummies; ++j) {
|
2018-10-18 06:09:48 +08:00
|
|
|
if (ActualArgument * arg{actualForDummy[j]}) {
|
2018-10-19 01:50:55 +08:00
|
|
|
rearranged[j] = std::move(*arg);
|
2018-10-18 06:09:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-17 07:58:13 +08:00
|
|
|
// Characterize the specific intrinsic procedure.
|
2019-05-04 02:29:15 +08:00
|
|
|
characteristics::DummyArguments dummyArgs;
|
|
|
|
std::optional<int> sameDummyArg;
|
2020-09-26 00:03:17 +08:00
|
|
|
|
2019-05-04 02:29:15 +08:00
|
|
|
for (std::size_t j{0}; j < dummies; ++j) {
|
|
|
|
const IntrinsicDummyArgument &d{dummy[std::min(j, dummyArgPatterns - 1)]};
|
|
|
|
if (const auto &arg{rearranged[j]}) {
|
2019-07-02 07:54:53 +08:00
|
|
|
if (const Expr<SomeType> *expr{arg->UnwrapExpr()}) {
|
2019-10-09 06:21:09 +08:00
|
|
|
auto dc{characteristics::DummyArgument::FromActual(
|
|
|
|
std::string{d.keyword}, *expr, context)};
|
[flang] Fix classification of shape inquiries in specification exprs
In some contexts, including the motivating case of determining whether
the expressions that define the shape of a variable are "constant expressions"
in the sense of the Fortran standard, expression rewriting via Fold()
is not necessary, and should not be required. The inquiry intrinsics LBOUND,
UBOUND, and SIZE work correctly now in specification expressions and are
classified correctly as being constant expressions (or not). Getting this right
led to a fair amount of API clean-up as a consequence, including the
folding of shapes and TypeAndShape objects, and new APIs for shapes
that do not fold for those cases where folding isn't needed. Further,
the symbol-testing predicate APIs in Evaluate/tools.h now all resolve any
associations of their symbols and work transparently on use-, host-, and
construct-association symbols; the tools used to resolve those associations have
been defined and documented more precisely, and their clients adjusted as needed.
Differential Revision: https://reviews.llvm.org/D94561
2021-01-13 07:36:45 +08:00
|
|
|
if (!dc) {
|
|
|
|
common::die("INTERNAL: could not characterize intrinsic function "
|
|
|
|
"actual argument '%s'",
|
|
|
|
expr->AsFortran().c_str());
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
2019-10-09 06:21:09 +08:00
|
|
|
dummyArgs.emplace_back(std::move(*dc));
|
2019-11-10 01:29:31 +08:00
|
|
|
if (d.typePattern.kindCode == KindCode::same && !sameDummyArg) {
|
2019-07-02 07:54:53 +08:00
|
|
|
sameDummyArg = j;
|
2019-05-04 02:29:15 +08:00
|
|
|
}
|
|
|
|
} else {
|
2019-11-10 01:29:31 +08:00
|
|
|
CHECK(arg->GetAssumedTypeDummy());
|
2019-09-17 07:58:13 +08:00
|
|
|
dummyArgs.emplace_back(std::string{d.keyword},
|
|
|
|
characteristics::DummyDataObject{DynamicType::AssumedType()});
|
2019-05-04 02:29:15 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// optional argument is absent
|
|
|
|
CHECK(d.optionality != Optionality::required);
|
|
|
|
if (d.typePattern.kindCode == KindCode::same) {
|
|
|
|
dummyArgs.emplace_back(dummyArgs[sameDummyArg.value()]);
|
|
|
|
} else {
|
|
|
|
auto category{d.typePattern.categorySet.LeastElement().value()};
|
|
|
|
characteristics::TypeAndShape typeAndShape{
|
|
|
|
DynamicType{category, defaults.GetDefaultKind(category)}};
|
2019-07-03 05:00:44 +08:00
|
|
|
dummyArgs.emplace_back(std::string{d.keyword},
|
2019-05-04 02:29:15 +08:00
|
|
|
characteristics::DummyDataObject{std::move(typeAndShape)});
|
|
|
|
}
|
2019-07-03 05:00:44 +08:00
|
|
|
dummyArgs.back().SetOptional();
|
2019-05-04 02:29:15 +08:00
|
|
|
}
|
2020-10-20 18:39:26 +08:00
|
|
|
dummyArgs.back().SetIntent(d.intent);
|
2019-05-04 02:29:15 +08:00
|
|
|
}
|
|
|
|
characteristics::Procedure::Attrs attrs;
|
|
|
|
if (elementalRank > 0) {
|
|
|
|
attrs.set(characteristics::Procedure::Attr::Elemental);
|
|
|
|
}
|
2019-09-17 07:58:13 +08:00
|
|
|
if (call.isSubroutineCall) {
|
|
|
|
return SpecificCall{
|
|
|
|
SpecificIntrinsic{
|
|
|
|
name, characteristics::Procedure{std::move(dummyArgs), attrs}},
|
|
|
|
std::move(rearranged)};
|
|
|
|
} else {
|
2019-11-13 07:43:09 +08:00
|
|
|
attrs.set(characteristics::Procedure::Attr::Pure);
|
2019-09-17 07:58:13 +08:00
|
|
|
characteristics::TypeAndShape typeAndShape{resultType.value(), resultRank};
|
|
|
|
characteristics::FunctionResult funcResult{std::move(typeAndShape)};
|
|
|
|
characteristics::Procedure chars{
|
|
|
|
std::move(funcResult), std::move(dummyArgs), attrs};
|
|
|
|
return SpecificCall{
|
|
|
|
SpecificIntrinsic{name, std::move(chars)}, std::move(rearranged)};
|
|
|
|
}
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
|
|
|
|
2019-02-23 07:45:30 +08:00
|
|
|
class IntrinsicProcTable::Implementation {
|
|
|
|
public:
|
2019-01-19 04:40:47 +08:00
|
|
|
explicit Implementation(const common::IntrinsicTypeDefaultKinds &dfts)
|
2020-03-29 12:00:16 +08:00
|
|
|
: defaults_{dfts} {
|
2018-10-05 04:43:33 +08:00
|
|
|
for (const IntrinsicInterface &f : genericIntrinsicFunction) {
|
2019-02-23 07:45:30 +08:00
|
|
|
genericFuncs_.insert(std::make_pair(std::string{f.name}, &f));
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
|
|
|
for (const SpecificIntrinsicInterface &f : specificIntrinsicFunction) {
|
2019-02-23 07:45:30 +08:00
|
|
|
specificFuncs_.insert(std::make_pair(std::string{f.name}, &f));
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
2019-09-17 07:58:13 +08:00
|
|
|
for (const IntrinsicInterface &f : intrinsicSubroutine) {
|
|
|
|
subroutines_.insert(std::make_pair(std::string{f.name}, &f));
|
|
|
|
}
|
2018-10-05 04:43:33 +08:00
|
|
|
}
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2019-02-27 06:26:28 +08:00
|
|
|
bool IsIntrinsic(const std::string &) const;
|
2020-10-26 18:25:40 +08:00
|
|
|
bool IsIntrinsicFunction(const std::string &) const;
|
|
|
|
bool IsIntrinsicSubroutine(const std::string &) const;
|
2019-02-27 06:26:28 +08:00
|
|
|
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
IntrinsicClass GetIntrinsicClass(const std::string &) const;
|
2020-07-30 20:29:24 +08:00
|
|
|
std::string GetGenericIntrinsicName(const std::string &) const;
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
|
2019-05-04 02:29:15 +08:00
|
|
|
std::optional<SpecificCall> Probe(const CallCharacteristics &,
|
|
|
|
ActualArguments &, FoldingContext &, const IntrinsicProcTable &) const;
|
2018-10-06 00:57:53 +08:00
|
|
|
|
2020-01-07 07:56:32 +08:00
|
|
|
std::optional<SpecificIntrinsicFunctionInterface> IsSpecificIntrinsicFunction(
|
|
|
|
const std::string &) const;
|
2019-02-23 07:45:30 +08:00
|
|
|
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &Dump(llvm::raw_ostream &) const;
|
2019-02-23 07:45:30 +08:00
|
|
|
|
|
|
|
private:
|
2019-05-04 02:29:15 +08:00
|
|
|
DynamicType GetSpecificType(const TypePattern &) const;
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
SpecificCall HandleNull(ActualArguments &, FoldingContext &) const;
|
2019-12-26 04:29:50 +08:00
|
|
|
std::optional<SpecificCall> HandleC_F_Pointer(
|
|
|
|
ActualArguments &, FoldingContext &) const;
|
2019-05-04 02:29:15 +08:00
|
|
|
|
2019-02-23 07:45:30 +08:00
|
|
|
common::IntrinsicTypeDefaultKinds defaults_;
|
|
|
|
std::multimap<std::string, const IntrinsicInterface *> genericFuncs_;
|
|
|
|
std::multimap<std::string, const SpecificIntrinsicInterface *> specificFuncs_;
|
2019-09-17 07:58:13 +08:00
|
|
|
std::multimap<std::string, const IntrinsicInterface *> subroutines_;
|
2018-09-29 08:02:11 +08:00
|
|
|
};
|
|
|
|
|
2020-10-26 18:25:40 +08:00
|
|
|
bool IntrinsicProcTable::Implementation::IsIntrinsicFunction(
|
2019-02-27 06:26:28 +08:00
|
|
|
const std::string &name) const {
|
|
|
|
auto specificRange{specificFuncs_.equal_range(name)};
|
|
|
|
if (specificRange.first != specificRange.second) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
auto genericRange{genericFuncs_.equal_range(name)};
|
|
|
|
if (genericRange.first != genericRange.second) {
|
|
|
|
return true;
|
|
|
|
}
|
2020-10-26 18:25:40 +08:00
|
|
|
// special cases
|
|
|
|
return name == "null";
|
|
|
|
}
|
|
|
|
bool IntrinsicProcTable::Implementation::IsIntrinsicSubroutine(
|
|
|
|
const std::string &name) const {
|
2019-09-17 07:58:13 +08:00
|
|
|
auto subrRange{subroutines_.equal_range(name)};
|
|
|
|
if (subrRange.first != subrRange.second) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-02-27 06:26:28 +08:00
|
|
|
// special cases
|
2020-10-26 18:25:40 +08:00
|
|
|
return name == "__builtin_c_f_pointer";
|
|
|
|
}
|
|
|
|
bool IntrinsicProcTable::Implementation::IsIntrinsic(
|
|
|
|
const std::string &name) const {
|
|
|
|
return IsIntrinsicFunction(name) || IsIntrinsicSubroutine(name);
|
2019-12-26 04:29:50 +08:00
|
|
|
}
|
|
|
|
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
IntrinsicClass IntrinsicProcTable::Implementation::GetIntrinsicClass(
|
|
|
|
const std::string &name) const {
|
|
|
|
auto specificIntrinsic{specificFuncs_.find(name)};
|
|
|
|
if (specificIntrinsic != specificFuncs_.end()) {
|
|
|
|
return specificIntrinsic->second->intrinsicClass;
|
|
|
|
}
|
|
|
|
auto genericIntrinsic{genericFuncs_.find(name)};
|
|
|
|
if (genericIntrinsic != genericFuncs_.end()) {
|
|
|
|
return genericIntrinsic->second->intrinsicClass;
|
|
|
|
}
|
|
|
|
auto subrIntrinsic{subroutines_.find(name)};
|
|
|
|
if (subrIntrinsic != subroutines_.end()) {
|
|
|
|
return subrIntrinsic->second->intrinsicClass;
|
|
|
|
}
|
|
|
|
return IntrinsicClass::noClass;
|
|
|
|
}
|
|
|
|
|
2020-07-30 20:29:24 +08:00
|
|
|
std::string IntrinsicProcTable::Implementation::GetGenericIntrinsicName(
|
|
|
|
const std::string &name) const {
|
|
|
|
auto specificIntrinsic{specificFuncs_.find(name)};
|
|
|
|
if (specificIntrinsic != specificFuncs_.end()) {
|
|
|
|
if (const char *genericName{specificIntrinsic->second->generic}) {
|
|
|
|
return {genericName};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2019-12-26 04:29:50 +08:00
|
|
|
bool CheckAndRearrangeArguments(ActualArguments &arguments,
|
|
|
|
parser::ContextualMessages &messages, const char *const dummyKeywords[],
|
|
|
|
std::size_t trailingOptionals) {
|
|
|
|
std::size_t numDummies{0};
|
|
|
|
while (dummyKeywords[numDummies]) {
|
|
|
|
++numDummies;
|
|
|
|
}
|
|
|
|
CHECK(trailingOptionals <= numDummies);
|
|
|
|
if (arguments.size() > numDummies) {
|
|
|
|
messages.Say("Too many actual arguments (%zd > %zd)"_err_en_US,
|
|
|
|
arguments.size(), numDummies);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ActualArguments rearranged(numDummies);
|
|
|
|
bool anyKeywords{false};
|
|
|
|
std::size_t position{0};
|
|
|
|
for (std::optional<ActualArgument> &arg : arguments) {
|
|
|
|
std::size_t dummyIndex{0};
|
|
|
|
if (arg && arg->keyword()) {
|
|
|
|
anyKeywords = true;
|
|
|
|
for (; dummyIndex < numDummies; ++dummyIndex) {
|
|
|
|
if (*arg->keyword() == dummyKeywords[dummyIndex]) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dummyIndex >= numDummies) {
|
|
|
|
messages.Say(*arg->keyword(),
|
|
|
|
"Unknown argument keyword '%s='"_err_en_US, *arg->keyword());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else if (anyKeywords) {
|
|
|
|
messages.Say(
|
|
|
|
"A positional actual argument may not appear after any keyword arguments"_err_en_US);
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
dummyIndex = position++;
|
|
|
|
}
|
|
|
|
if (rearranged[dummyIndex]) {
|
|
|
|
messages.Say("Dummy argument '%s=' appears more than once"_err_en_US,
|
|
|
|
dummyKeywords[dummyIndex]);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
rearranged[dummyIndex] = std::move(arg);
|
|
|
|
arg.reset();
|
|
|
|
}
|
|
|
|
bool anyMissing{false};
|
|
|
|
for (std::size_t j{0}; j < numDummies - trailingOptionals; ++j) {
|
|
|
|
if (!rearranged[j]) {
|
|
|
|
messages.Say("Dummy argument '%s=' is absent and not OPTIONAL"_err_en_US,
|
|
|
|
dummyKeywords[j]);
|
|
|
|
anyMissing = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
arguments = std::move(rearranged);
|
|
|
|
return !anyMissing;
|
2019-02-27 06:26:28 +08:00
|
|
|
}
|
|
|
|
|
2019-05-04 02:29:15 +08:00
|
|
|
// The NULL() intrinsic is a special case.
|
|
|
|
SpecificCall IntrinsicProcTable::Implementation::HandleNull(
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
ActualArguments &arguments, FoldingContext &context) const {
|
2019-12-26 04:29:50 +08:00
|
|
|
static const char *const keywords[]{"mold", nullptr};
|
|
|
|
if (CheckAndRearrangeArguments(arguments, context.messages(), keywords, 1) &&
|
|
|
|
arguments[0]) {
|
|
|
|
if (Expr<SomeType> * mold{arguments[0]->UnwrapExpr()}) {
|
2020-09-26 00:03:17 +08:00
|
|
|
bool goodProcPointer{true};
|
2019-12-26 04:29:50 +08:00
|
|
|
if (IsAllocatableOrPointer(*mold)) {
|
|
|
|
characteristics::DummyArguments args;
|
|
|
|
std::optional<characteristics::FunctionResult> fResult;
|
|
|
|
if (IsProcedurePointer(*mold)) {
|
|
|
|
// MOLD= procedure pointer
|
|
|
|
const Symbol *last{GetLastSymbol(*mold)};
|
|
|
|
CHECK(last);
|
|
|
|
auto procPointer{
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
characteristics::Procedure::Characterize(*last, context)};
|
2020-09-26 00:03:17 +08:00
|
|
|
// procPointer is null if there was an error with the analysis
|
|
|
|
// associated with the procedure pointer
|
|
|
|
if (procPointer) {
|
|
|
|
args.emplace_back("mold"s,
|
|
|
|
characteristics::DummyProcedure{common::Clone(*procPointer)});
|
|
|
|
fResult.emplace(std::move(*procPointer));
|
|
|
|
} else {
|
|
|
|
goodProcPointer = false;
|
|
|
|
}
|
2019-12-26 04:29:50 +08:00
|
|
|
} else if (auto type{mold->GetType()}) {
|
|
|
|
// MOLD= object pointer
|
|
|
|
characteristics::TypeAndShape typeAndShape{
|
|
|
|
*type, GetShape(context, *mold)};
|
|
|
|
args.emplace_back(
|
|
|
|
"mold"s, characteristics::DummyDataObject{typeAndShape});
|
|
|
|
fResult.emplace(std::move(typeAndShape));
|
|
|
|
} else {
|
|
|
|
context.messages().Say(
|
|
|
|
"MOLD= argument to NULL() lacks type"_err_en_US);
|
2019-05-04 02:29:15 +08:00
|
|
|
}
|
2020-09-26 00:03:17 +08:00
|
|
|
if (goodProcPointer) {
|
|
|
|
fResult->attrs.set(characteristics::FunctionResult::Attr::Pointer);
|
|
|
|
characteristics::Procedure::Attrs attrs;
|
|
|
|
attrs.set(characteristics::Procedure::Attr::NullPointer);
|
|
|
|
characteristics::Procedure chars{
|
|
|
|
std::move(*fResult), std::move(args), attrs};
|
|
|
|
return SpecificCall{SpecificIntrinsic{"null"s, std::move(chars)},
|
|
|
|
std::move(arguments)};
|
|
|
|
}
|
2019-05-04 02:29:15 +08:00
|
|
|
}
|
|
|
|
}
|
2019-12-26 04:29:50 +08:00
|
|
|
context.messages().Say(
|
|
|
|
"MOLD= argument to NULL() must be a pointer or allocatable"_err_en_US);
|
2019-05-04 02:29:15 +08:00
|
|
|
}
|
|
|
|
characteristics::Procedure::Attrs attrs;
|
|
|
|
attrs.set(characteristics::Procedure::Attr::NullPointer);
|
2019-12-26 04:29:50 +08:00
|
|
|
attrs.set(characteristics::Procedure::Attr::Pure);
|
2019-05-04 02:29:15 +08:00
|
|
|
arguments.clear();
|
|
|
|
return SpecificCall{
|
|
|
|
SpecificIntrinsic{"null"s,
|
|
|
|
characteristics::Procedure{characteristics::DummyArguments{}, attrs}},
|
|
|
|
std::move(arguments)};
|
|
|
|
}
|
|
|
|
|
2019-12-26 04:29:50 +08:00
|
|
|
// Subroutine C_F_POINTER(CPTR=,FPTR=[,SHAPE=]) from
|
|
|
|
// intrinsic module ISO_C_BINDING (18.2.3.3)
|
|
|
|
std::optional<SpecificCall>
|
|
|
|
IntrinsicProcTable::Implementation::HandleC_F_Pointer(
|
|
|
|
ActualArguments &arguments, FoldingContext &context) const {
|
|
|
|
characteristics::Procedure::Attrs attrs;
|
|
|
|
attrs.set(characteristics::Procedure::Attr::Subroutine);
|
|
|
|
static const char *const keywords[]{"cptr", "fptr", "shape", nullptr};
|
|
|
|
characteristics::DummyArguments dummies;
|
|
|
|
if (CheckAndRearrangeArguments(arguments, context.messages(), keywords, 1)) {
|
|
|
|
CHECK(arguments.size() == 3);
|
|
|
|
if (const auto *expr{arguments[0].value().UnwrapExpr()}) {
|
|
|
|
if (expr->Rank() > 0) {
|
|
|
|
context.messages().Say(
|
|
|
|
"CPTR= argument to C_F_POINTER() must be scalar"_err_en_US);
|
|
|
|
}
|
|
|
|
if (auto type{expr->GetType()}) {
|
|
|
|
if (type->category() != TypeCategory::Derived ||
|
|
|
|
type->IsPolymorphic() ||
|
|
|
|
type->GetDerivedTypeSpec().typeSymbol().name() !=
|
|
|
|
"__builtin_c_ptr") {
|
|
|
|
context.messages().Say(
|
|
|
|
"CPTR= argument to C_F_POINTER() must be a C_PTR"_err_en_US);
|
|
|
|
}
|
|
|
|
characteristics::DummyDataObject cptr{
|
|
|
|
characteristics::TypeAndShape{*type}};
|
|
|
|
cptr.intent = common::Intent::In;
|
|
|
|
dummies.emplace_back("cptr"s, std::move(cptr));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (const auto *expr{arguments[1].value().UnwrapExpr()}) {
|
|
|
|
int fptrRank{expr->Rank()};
|
|
|
|
if (auto type{expr->GetType()}) {
|
|
|
|
if (type->HasDeferredTypeParameter()) {
|
|
|
|
context.messages().Say(
|
|
|
|
"FPTR= argument to C_F_POINTER() may not have a deferred type parameter"_err_en_US);
|
|
|
|
}
|
|
|
|
if (ExtractCoarrayRef(*expr)) {
|
|
|
|
context.messages().Say(
|
|
|
|
"FPTR= argument to C_F_POINTER() may not be a coindexed object"_err_en_US);
|
|
|
|
}
|
|
|
|
characteristics::DummyDataObject fptr{
|
|
|
|
characteristics::TypeAndShape{*type, fptrRank}};
|
|
|
|
fptr.intent = common::Intent::Out;
|
|
|
|
fptr.attrs.set(characteristics::DummyDataObject::Attr::Pointer);
|
|
|
|
dummies.emplace_back("fptr"s, std::move(fptr));
|
|
|
|
}
|
|
|
|
if (arguments[2] && fptrRank == 0) {
|
|
|
|
context.messages().Say(
|
|
|
|
"SHAPE= argument to C_F_POINTER() may not appear when FPTR= is scalar"_err_en_US);
|
|
|
|
} else if (!arguments[2] && fptrRank > 0) {
|
|
|
|
context.messages().Say(
|
|
|
|
"SHAPE= argument to C_F_POINTER() must appear when FPTR= is an array"_err_en_US);
|
|
|
|
}
|
2020-01-04 08:32:23 +08:00
|
|
|
if (arguments[2]) {
|
|
|
|
DynamicType shapeType{
|
|
|
|
TypeCategory::Integer, defaults_.sizeIntegerKind()};
|
|
|
|
if (auto type{arguments[2]->GetType()}) {
|
|
|
|
if (type->category() == TypeCategory::Integer) {
|
|
|
|
shapeType = *type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
characteristics::DummyDataObject shape{
|
|
|
|
characteristics::TypeAndShape{shapeType, 1}};
|
|
|
|
shape.intent = common::Intent::In;
|
|
|
|
shape.attrs.set(characteristics::DummyDataObject::Attr::Optional);
|
|
|
|
dummies.emplace_back("shape"s, std::move(shape));
|
|
|
|
}
|
2019-12-26 04:29:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dummies.size() == 3) {
|
|
|
|
return SpecificCall{
|
|
|
|
SpecificIntrinsic{"__builtin_c_f_pointer"s,
|
|
|
|
characteristics::Procedure{std::move(dummies), attrs}},
|
|
|
|
std::move(arguments)};
|
|
|
|
} else {
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
static bool CheckAssociated(SpecificCall &call, FoldingContext &context) {
|
2020-09-26 00:03:17 +08:00
|
|
|
bool ok{true};
|
|
|
|
if (const auto &pointerArg{call.arguments[0]}) {
|
|
|
|
if (const auto *pointerExpr{pointerArg->UnwrapExpr()}) {
|
|
|
|
if (const Symbol * pointerSymbol{GetLastSymbol(*pointerExpr)}) {
|
|
|
|
if (!pointerSymbol->attrs().test(semantics::Attr::POINTER)) {
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
AttachDeclaration(context.messages().Say(
|
|
|
|
"POINTER= argument of ASSOCIATED() must be a "
|
|
|
|
"POINTER"_err_en_US),
|
2020-09-26 00:03:17 +08:00
|
|
|
*pointerSymbol);
|
|
|
|
} else {
|
|
|
|
const auto pointerProc{characteristics::Procedure::Characterize(
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
*pointerSymbol, context)};
|
2020-09-26 00:03:17 +08:00
|
|
|
if (const auto &targetArg{call.arguments[1]}) {
|
|
|
|
if (const auto *targetExpr{targetArg->UnwrapExpr()}) {
|
|
|
|
std::optional<characteristics::Procedure> targetProc{
|
|
|
|
std::nullopt};
|
|
|
|
const Symbol *targetSymbol{GetLastSymbol(*targetExpr)};
|
|
|
|
bool isCall{false};
|
|
|
|
std::string targetName;
|
|
|
|
if (const auto *targetProcRef{// target is a function call
|
|
|
|
std::get_if<ProcedureRef>(&targetExpr->u)}) {
|
|
|
|
if (auto targetRefedChars{
|
|
|
|
characteristics::Procedure::Characterize(
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
*targetProcRef, context)}) {
|
2020-09-26 00:03:17 +08:00
|
|
|
targetProc = *targetRefedChars;
|
|
|
|
targetName = targetProcRef->proc().GetName() + "()";
|
|
|
|
isCall = true;
|
|
|
|
}
|
|
|
|
} else if (targetSymbol && !targetProc) {
|
|
|
|
// proc that's not a call
|
|
|
|
targetProc = characteristics::Procedure::Characterize(
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
*targetSymbol, context);
|
2020-09-26 00:03:17 +08:00
|
|
|
targetName = targetSymbol->name().ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pointerProc) {
|
|
|
|
if (targetProc) {
|
|
|
|
// procedure pointer and procedure target
|
|
|
|
if (std::optional<parser::MessageFixedText> msg{
|
|
|
|
CheckProcCompatibility(
|
|
|
|
isCall, pointerProc, &*targetProc)}) {
|
|
|
|
AttachDeclaration(
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
context.messages().Say(std::move(*msg),
|
2020-09-26 00:03:17 +08:00
|
|
|
"pointer '" + pointerSymbol->name().ToString() +
|
|
|
|
"'",
|
|
|
|
targetName),
|
|
|
|
*pointerSymbol);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// procedure pointer and object target
|
|
|
|
if (!IsNullPointer(*targetExpr)) {
|
|
|
|
AttachDeclaration(
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
context.messages().Say(
|
2020-09-26 00:03:17 +08:00
|
|
|
"POINTER= argument '%s' is a procedure "
|
|
|
|
"pointer but the TARGET= argument '%s' is not a "
|
|
|
|
"procedure or procedure pointer"_err_en_US,
|
|
|
|
pointerSymbol->name(), targetName),
|
|
|
|
*pointerSymbol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (targetProc) {
|
|
|
|
// object pointer and procedure target
|
|
|
|
AttachDeclaration(
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
context.messages().Say(
|
|
|
|
"POINTER= argument '%s' is an object pointer "
|
|
|
|
"but the TARGET= argument '%s' is a "
|
|
|
|
"procedure designator"_err_en_US,
|
2020-09-26 00:03:17 +08:00
|
|
|
pointerSymbol->name(), targetName),
|
|
|
|
*pointerSymbol);
|
|
|
|
} else {
|
|
|
|
// object pointer and target
|
2020-10-20 02:01:13 +08:00
|
|
|
if (const Symbol * targetSymbol{GetLastSymbol(*targetExpr)}) {
|
|
|
|
if (!(targetSymbol->attrs().test(semantics::Attr::POINTER) ||
|
|
|
|
targetSymbol->attrs().test(
|
|
|
|
semantics::Attr::TARGET))) {
|
|
|
|
AttachDeclaration(
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
context.messages().Say(
|
|
|
|
"TARGET= argument '%s' must have either "
|
|
|
|
"the POINTER or the TARGET "
|
|
|
|
"attribute"_err_en_US,
|
2020-10-20 02:01:13 +08:00
|
|
|
targetName),
|
|
|
|
*targetSymbol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-26 00:03:17 +08:00
|
|
|
if (const auto pointerType{pointerArg->GetType()}) {
|
|
|
|
if (const auto targetType{targetArg->GetType()}) {
|
|
|
|
ok = pointerType->IsTkCompatibleWith(*targetType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No arguments to ASSOCIATED()
|
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
if (!ok) {
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
context.messages().Say(
|
2020-09-26 00:03:17 +08:00
|
|
|
"Arguments of ASSOCIATED() must be a POINTER and an optional valid target"_err_en_US);
|
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2019-06-20 02:50:07 +08:00
|
|
|
// Applies any semantic checks peculiar to an intrinsic.
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
static bool ApplySpecificChecks(SpecificCall &call, FoldingContext &context) {
|
2019-06-20 02:50:07 +08:00
|
|
|
bool ok{true};
|
|
|
|
const std::string &name{call.specificIntrinsic.name};
|
|
|
|
if (name == "allocated") {
|
|
|
|
if (const auto &arg{call.arguments[0]}) {
|
|
|
|
if (const auto *expr{arg->UnwrapExpr()}) {
|
|
|
|
if (const Symbol * symbol{GetLastSymbol(*expr)}) {
|
2019-08-02 05:01:06 +08:00
|
|
|
ok = symbol->attrs().test(semantics::Attr::ALLOCATABLE);
|
2019-06-20 02:50:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!ok) {
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
context.messages().Say(
|
2019-06-20 02:50:07 +08:00
|
|
|
"Argument of ALLOCATED() must be an ALLOCATABLE object or component"_err_en_US);
|
|
|
|
}
|
2019-06-22 05:04:40 +08:00
|
|
|
} else if (name == "associated") {
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
return CheckAssociated(call, context);
|
2019-07-02 04:22:22 +08:00
|
|
|
} else if (name == "loc") {
|
|
|
|
if (const auto &arg{call.arguments[0]}) {
|
2019-11-10 01:29:31 +08:00
|
|
|
ok = arg->GetAssumedTypeDummy() || GetLastSymbol(arg->UnwrapExpr());
|
2019-07-02 04:22:22 +08:00
|
|
|
}
|
|
|
|
if (!ok) {
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
context.messages().Say(
|
2019-07-02 04:22:22 +08:00
|
|
|
"Argument of LOC() must be an object or procedure"_err_en_US);
|
|
|
|
}
|
2019-06-20 02:50:07 +08:00
|
|
|
} else if (name == "present") {
|
|
|
|
if (const auto &arg{call.arguments[0]}) {
|
|
|
|
if (const auto *expr{arg->UnwrapExpr()}) {
|
|
|
|
if (const Symbol * symbol{UnwrapWholeSymbolDataRef(*expr)}) {
|
|
|
|
ok = symbol->attrs().test(semantics::Attr::OPTIONAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!ok) {
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
context.messages().Say(
|
2019-06-20 02:50:07 +08:00
|
|
|
"Argument of PRESENT() must be the name of an OPTIONAL dummy argument"_err_en_US);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ok;
|
2019-06-20 03:37:49 +08:00
|
|
|
}
|
2019-06-20 02:50:07 +08:00
|
|
|
|
2019-09-17 18:11:35 +08:00
|
|
|
static DynamicType GetReturnType(const SpecificIntrinsicInterface &interface,
|
|
|
|
const common::IntrinsicTypeDefaultKinds &defaults) {
|
|
|
|
TypeCategory category{TypeCategory::Integer};
|
|
|
|
switch (interface.result.kindCode) {
|
2020-03-29 12:00:16 +08:00
|
|
|
case KindCode::defaultIntegerKind:
|
|
|
|
break;
|
2019-09-17 18:11:35 +08:00
|
|
|
case KindCode::doublePrecision:
|
2020-03-29 12:00:16 +08:00
|
|
|
case KindCode::defaultRealKind:
|
|
|
|
category = TypeCategory::Real;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
CRASH_NO_CASE;
|
2019-09-17 18:11:35 +08:00
|
|
|
}
|
|
|
|
int kind{interface.result.kindCode == KindCode::doublePrecision
|
|
|
|
? defaults.doublePrecisionKind()
|
|
|
|
: defaults.GetDefaultKind(category)};
|
|
|
|
return DynamicType{category, kind};
|
|
|
|
}
|
|
|
|
|
2018-10-06 02:32:54 +08:00
|
|
|
// Probe the configured intrinsic procedure pattern tables in search of a
|
|
|
|
// match for a given procedure reference.
|
2018-10-18 06:09:48 +08:00
|
|
|
std::optional<SpecificCall> IntrinsicProcTable::Implementation::Probe(
|
|
|
|
const CallCharacteristics &call, ActualArguments &arguments,
|
2019-05-04 02:29:15 +08:00
|
|
|
FoldingContext &context, const IntrinsicProcTable &intrinsics) const {
|
2019-12-26 04:29:50 +08:00
|
|
|
|
|
|
|
// All special cases handled here before the table probes below must
|
|
|
|
// also be recognized as special names in IsIntrinsic().
|
|
|
|
if (call.isSubroutineCall) {
|
|
|
|
if (call.name == "__builtin_c_f_pointer") {
|
|
|
|
return HandleC_F_Pointer(arguments, context);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (call.name == "null") {
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
return HandleNull(arguments, context);
|
2019-12-26 04:29:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-06 00:57:53 +08:00
|
|
|
if (call.isSubroutineCall) {
|
2019-12-12 07:06:24 +08:00
|
|
|
auto subrRange{subroutines_.equal_range(call.name)};
|
2019-09-17 07:58:13 +08:00
|
|
|
for (auto iter{subrRange.first}; iter != subrRange.second; ++iter) {
|
|
|
|
if (auto specificCall{
|
|
|
|
iter->second->Match(call, defaults_, arguments, context)}) {
|
|
|
|
return specificCall;
|
|
|
|
}
|
|
|
|
}
|
2020-10-26 18:25:40 +08:00
|
|
|
if (IsIntrinsicFunction(call.name)) {
|
|
|
|
context.messages().Say(
|
|
|
|
"Cannot use intrinsic function '%s' as a subroutine"_err_en_US,
|
|
|
|
call.name);
|
|
|
|
}
|
2020-03-29 12:00:16 +08:00
|
|
|
return std::nullopt; // TODO
|
2018-10-06 00:57:53 +08:00
|
|
|
}
|
2019-09-17 18:11:35 +08:00
|
|
|
|
|
|
|
// Helper to avoid emitting errors before it is sure there is no match
|
2019-06-06 06:40:59 +08:00
|
|
|
parser::Messages localBuffer;
|
2019-09-17 18:11:35 +08:00
|
|
|
parser::Messages *finalBuffer{context.messages().messages()};
|
2019-05-14 00:33:18 +08:00
|
|
|
parser::ContextualMessages localMessages{
|
2019-12-12 07:06:24 +08:00
|
|
|
context.messages().at(), finalBuffer ? &localBuffer : nullptr};
|
2019-05-14 00:33:18 +08:00
|
|
|
FoldingContext localContext{context, localMessages};
|
2019-09-17 18:11:35 +08:00
|
|
|
auto matchOrBufferMessages{
|
|
|
|
[&](const IntrinsicInterface &intrinsic,
|
|
|
|
parser::Messages &buffer) -> std::optional<SpecificCall> {
|
|
|
|
if (auto specificCall{
|
|
|
|
intrinsic.Match(call, defaults_, arguments, localContext)}) {
|
2019-11-10 01:29:31 +08:00
|
|
|
if (finalBuffer) {
|
2019-09-17 18:11:35 +08:00
|
|
|
finalBuffer->Annex(std::move(localBuffer));
|
|
|
|
}
|
|
|
|
return specificCall;
|
|
|
|
} else if (buffer.empty()) {
|
|
|
|
buffer.Annex(std::move(localBuffer));
|
|
|
|
} else {
|
|
|
|
localBuffer.clear();
|
|
|
|
}
|
|
|
|
return std::nullopt;
|
|
|
|
}};
|
|
|
|
|
|
|
|
// Probe the generic intrinsic function table first.
|
2018-10-12 08:01:31 +08:00
|
|
|
parser::Messages genericBuffer;
|
2019-12-12 07:06:24 +08:00
|
|
|
auto genericRange{genericFuncs_.equal_range(call.name)};
|
2018-10-06 00:57:53 +08:00
|
|
|
for (auto iter{genericRange.first}; iter != genericRange.second; ++iter) {
|
2018-10-18 06:09:48 +08:00
|
|
|
if (auto specificCall{
|
2019-09-17 18:11:35 +08:00
|
|
|
matchOrBufferMessages(*iter->second, genericBuffer)}) {
|
[flang] Improve initializer semantics, esp. for component default values
This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development. We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding. Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.
Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
derived type instantiations so that the user can figure out which
instance caused a problem with a component, have been added as part
of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
is passed as an argument rather than just its intrinsic procedure table;
this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
actually is a single constant value and to validate a non-pointer
variable initializer or object component default value
* shape conformance checking has additional arguments that control
whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
a crash, which might be useful in the future
TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.
Differential Review: https://reviews.llvm.org/D92783
2020-12-08 04:08:58 +08:00
|
|
|
ApplySpecificChecks(*specificCall, context);
|
2018-10-18 06:09:48 +08:00
|
|
|
return specificCall;
|
2018-10-06 00:57:53 +08:00
|
|
|
}
|
|
|
|
}
|
2019-09-17 18:11:35 +08:00
|
|
|
|
2019-06-06 06:40:59 +08:00
|
|
|
// Probe the specific intrinsic function table next.
|
|
|
|
parser::Messages specificBuffer;
|
2019-12-12 07:06:24 +08:00
|
|
|
auto specificRange{specificFuncs_.equal_range(call.name)};
|
2019-06-06 06:40:59 +08:00
|
|
|
for (auto specIter{specificRange.first}; specIter != specificRange.second;
|
|
|
|
++specIter) {
|
|
|
|
// We only need to check the cases with distinct generic names.
|
|
|
|
if (const char *genericName{specIter->second->generic}) {
|
2019-09-17 18:11:35 +08:00
|
|
|
if (auto specificCall{
|
|
|
|
matchOrBufferMessages(*specIter->second, specificBuffer)}) {
|
[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit
Summary:
This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.
- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let
folding rewrite it and introduc the conversion on the MIN/MAX result.
- Also make operand promotion explicit in MIN/MAX folding.
For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))
All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.
Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby
Reviewed By: klausler, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D81940
2020-06-18 13:46:19 +08:00
|
|
|
if (!specIter->second->useGenericAndForceResultType) {
|
|
|
|
specificCall->specificIntrinsic.name = genericName;
|
|
|
|
}
|
2019-08-23 20:03:41 +08:00
|
|
|
specificCall->specificIntrinsic.isRestrictedSpecific =
|
|
|
|
specIter->second->isRestrictedSpecific;
|
|
|
|
// TODO test feature AdditionalIntrinsics, warn on nonstandard
|
|
|
|
// specifics with DoublePrecisionComplex arguments.
|
|
|
|
return specificCall;
|
2019-06-06 06:40:59 +08:00
|
|
|
}
|
2019-09-17 18:11:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If there was no exact match with a specific, try to match the related
|
|
|
|
// generic and convert the result to the specific required type.
|
|
|
|
for (auto specIter{specificRange.first}; specIter != specificRange.second;
|
|
|
|
++specIter) {
|
|
|
|
// We only need to check the cases with distinct generic names.
|
|
|
|
if (const char *genericName{specIter->second->generic}) {
|
2019-09-17 00:34:10 +08:00
|
|
|
if (specIter->second->useGenericAndForceResultType) {
|
|
|
|
auto genericRange{genericFuncs_.equal_range(genericName)};
|
|
|
|
for (auto genIter{genericRange.first}; genIter != genericRange.second;
|
|
|
|
++genIter) {
|
2019-09-17 18:11:35 +08:00
|
|
|
if (auto specificCall{
|
|
|
|
matchOrBufferMessages(*genIter->second, specificBuffer)}) {
|
|
|
|
// Force the call result type to the specific intrinsic result type
|
|
|
|
DynamicType newType{GetReturnType(*specIter->second, defaults_)};
|
|
|
|
context.messages().Say(
|
[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit
Summary:
This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.
- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let
folding rewrite it and introduc the conversion on the MIN/MAX result.
- Also make operand promotion explicit in MIN/MAX folding.
For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))
All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.
Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby
Reviewed By: klausler, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D81940
2020-06-18 13:46:19 +08:00
|
|
|
"argument types do not match specific intrinsic '%s' "
|
2019-09-18 23:04:52 +08:00
|
|
|
"requirements; using '%s' generic instead and converting the "
|
2019-09-17 16:54:51 +08:00
|
|
|
"result to %s if needed"_en_US,
|
2019-12-12 07:06:24 +08:00
|
|
|
call.name, genericName, newType.AsFortran());
|
[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit
Summary:
This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.
- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let
folding rewrite it and introduc the conversion on the MIN/MAX result.
- Also make operand promotion explicit in MIN/MAX folding.
For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))
All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.
Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby
Reviewed By: klausler, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D81940
2020-06-18 13:46:19 +08:00
|
|
|
specificCall->specificIntrinsic.name = call.name;
|
2019-09-17 18:11:35 +08:00
|
|
|
specificCall->specificIntrinsic.characteristics.value()
|
|
|
|
.functionResult.value()
|
|
|
|
.SetType(newType);
|
2019-09-17 00:34:10 +08:00
|
|
|
return specificCall;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-06 06:40:59 +08:00
|
|
|
}
|
|
|
|
}
|
2019-09-17 18:11:35 +08:00
|
|
|
|
2020-10-26 18:25:40 +08:00
|
|
|
if (specificBuffer.empty() && genericBuffer.empty() &&
|
|
|
|
IsIntrinsicSubroutine(call.name)) {
|
|
|
|
context.messages().Say(
|
|
|
|
"Cannot use intrinsic subroutine '%s' as a function"_err_en_US,
|
|
|
|
call.name);
|
|
|
|
}
|
|
|
|
|
2019-05-04 02:29:15 +08:00
|
|
|
// No match; report the right errors, if any
|
2019-11-10 01:29:31 +08:00
|
|
|
if (finalBuffer) {
|
2019-06-06 06:40:59 +08:00
|
|
|
if (specificBuffer.empty()) {
|
2018-10-13 07:01:55 +08:00
|
|
|
finalBuffer->Annex(std::move(genericBuffer));
|
2019-06-06 06:40:59 +08:00
|
|
|
} else {
|
|
|
|
finalBuffer->Annex(std::move(specificBuffer));
|
2018-10-12 08:01:31 +08:00
|
|
|
}
|
2018-10-06 02:32:54 +08:00
|
|
|
}
|
2018-10-06 00:57:53 +08:00
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
2020-01-07 07:56:32 +08:00
|
|
|
std::optional<SpecificIntrinsicFunctionInterface>
|
|
|
|
IntrinsicProcTable::Implementation::IsSpecificIntrinsicFunction(
|
2019-02-23 07:45:30 +08:00
|
|
|
const std::string &name) const {
|
|
|
|
auto specificRange{specificFuncs_.equal_range(name)};
|
|
|
|
for (auto iter{specificRange.first}; iter != specificRange.second; ++iter) {
|
|
|
|
const SpecificIntrinsicInterface &specific{*iter->second};
|
2020-01-07 07:56:32 +08:00
|
|
|
std::string genericName{name};
|
|
|
|
if (specific.generic) {
|
|
|
|
genericName = std::string(specific.generic);
|
|
|
|
}
|
|
|
|
characteristics::FunctionResult fResult{GetSpecificType(specific.result)};
|
|
|
|
characteristics::DummyArguments args;
|
|
|
|
int dummies{specific.CountArguments()};
|
|
|
|
for (int j{0}; j < dummies; ++j) {
|
|
|
|
characteristics::DummyDataObject dummy{
|
|
|
|
GetSpecificType(specific.dummy[j].typePattern)};
|
2020-10-20 18:39:26 +08:00
|
|
|
dummy.intent = specific.dummy[j].intent;
|
2020-01-07 07:56:32 +08:00
|
|
|
args.emplace_back(
|
|
|
|
std::string{specific.dummy[j].keyword}, std::move(dummy));
|
2019-02-23 07:45:30 +08:00
|
|
|
}
|
2020-01-07 07:56:32 +08:00
|
|
|
characteristics::Procedure::Attrs attrs;
|
|
|
|
attrs.set(characteristics::Procedure::Attr::Pure)
|
|
|
|
.set(characteristics::Procedure::Attr::Elemental);
|
|
|
|
characteristics::Procedure chars{
|
|
|
|
std::move(fResult), std::move(args), attrs};
|
|
|
|
return SpecificIntrinsicFunctionInterface{
|
|
|
|
std::move(chars), genericName, specific.isRestrictedSpecific};
|
2019-02-23 07:45:30 +08:00
|
|
|
}
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
DynamicType IntrinsicProcTable::Implementation::GetSpecificType(
|
|
|
|
const TypePattern &pattern) const {
|
|
|
|
const CategorySet &set{pattern.categorySet};
|
|
|
|
CHECK(set.count() == 1);
|
|
|
|
TypeCategory category{set.LeastElement().value()};
|
|
|
|
return DynamicType{category, defaults_.GetDefaultKind(category)};
|
|
|
|
}
|
|
|
|
|
2020-10-24 11:59:57 +08:00
|
|
|
IntrinsicProcTable::~IntrinsicProcTable() = default;
|
2018-09-29 08:02:11 +08:00
|
|
|
|
2018-10-09 06:35:19 +08:00
|
|
|
IntrinsicProcTable IntrinsicProcTable::Configure(
|
2019-01-19 04:40:47 +08:00
|
|
|
const common::IntrinsicTypeDefaultKinds &defaults) {
|
2018-10-09 06:35:19 +08:00
|
|
|
IntrinsicProcTable result;
|
2020-10-24 11:59:57 +08:00
|
|
|
result.impl_ = std::make_unique<IntrinsicProcTable::Implementation>(defaults);
|
2018-09-29 08:02:11 +08:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2019-02-27 06:26:28 +08:00
|
|
|
bool IntrinsicProcTable::IsIntrinsic(const std::string &name) const {
|
2019-10-03 03:40:52 +08:00
|
|
|
return DEREF(impl_).IsIntrinsic(name);
|
2019-02-27 06:26:28 +08:00
|
|
|
}
|
2020-10-26 18:25:40 +08:00
|
|
|
bool IntrinsicProcTable::IsIntrinsicFunction(const std::string &name) const {
|
|
|
|
return DEREF(impl_).IsIntrinsicFunction(name);
|
|
|
|
}
|
|
|
|
bool IntrinsicProcTable::IsIntrinsicSubroutine(const std::string &name) const {
|
|
|
|
return DEREF(impl_).IsIntrinsicSubroutine(name);
|
|
|
|
}
|
2019-02-27 06:26:28 +08:00
|
|
|
|
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
2020-05-02 04:00:28 +08:00
|
|
|
IntrinsicClass IntrinsicProcTable::GetIntrinsicClass(
|
|
|
|
const std::string &name) const {
|
|
|
|
return DEREF(impl_).GetIntrinsicClass(name);
|
|
|
|
}
|
|
|
|
|
2020-07-30 20:29:24 +08:00
|
|
|
std::string IntrinsicProcTable::GetGenericIntrinsicName(
|
|
|
|
const std::string &name) const {
|
|
|
|
return DEREF(impl_).GetGenericIntrinsicName(name);
|
|
|
|
}
|
|
|
|
|
2018-10-18 06:09:48 +08:00
|
|
|
std::optional<SpecificCall> IntrinsicProcTable::Probe(
|
|
|
|
const CallCharacteristics &call, ActualArguments &arguments,
|
2019-04-19 05:11:15 +08:00
|
|
|
FoldingContext &context) const {
|
2019-10-03 03:40:52 +08:00
|
|
|
return DEREF(impl_).Probe(call, arguments, context, *this);
|
2018-09-29 08:02:11 +08:00
|
|
|
}
|
2018-10-12 05:51:14 +08:00
|
|
|
|
2020-01-07 07:56:32 +08:00
|
|
|
std::optional<SpecificIntrinsicFunctionInterface>
|
|
|
|
IntrinsicProcTable::IsSpecificIntrinsicFunction(const std::string &name) const {
|
|
|
|
return DEREF(impl_).IsSpecificIntrinsicFunction(name);
|
2019-02-23 07:45:30 +08:00
|
|
|
}
|
|
|
|
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &TypePattern::Dump(llvm::raw_ostream &o) const {
|
2018-10-13 07:01:55 +08:00
|
|
|
if (categorySet == AnyType) {
|
|
|
|
o << "any type";
|
|
|
|
} else {
|
|
|
|
const char *sep = "";
|
|
|
|
auto set{categorySet};
|
|
|
|
while (auto least{set.LeastElement()}) {
|
|
|
|
o << sep << EnumToString(*least);
|
|
|
|
sep = " or ";
|
|
|
|
set.reset(*least);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
o << '(' << EnumToString(kindCode) << ')';
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &IntrinsicDummyArgument::Dump(llvm::raw_ostream &o) const {
|
2018-10-13 07:01:55 +08:00
|
|
|
if (keyword) {
|
|
|
|
o << keyword << '=';
|
|
|
|
}
|
|
|
|
return typePattern.Dump(o)
|
2020-10-20 18:39:26 +08:00
|
|
|
<< ' ' << EnumToString(rank) << ' ' << EnumToString(optionality)
|
|
|
|
<< EnumToString(intent);
|
2018-10-13 07:01:55 +08:00
|
|
|
}
|
|
|
|
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &IntrinsicInterface::Dump(llvm::raw_ostream &o) const {
|
2018-10-13 07:01:55 +08:00
|
|
|
o << name;
|
|
|
|
char sep{'('};
|
|
|
|
for (const auto &d : dummy) {
|
|
|
|
if (d.typePattern.kindCode == KindCode::none) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
d.Dump(o << sep);
|
|
|
|
sep = ',';
|
|
|
|
}
|
|
|
|
if (sep == '(') {
|
|
|
|
o << "()";
|
|
|
|
}
|
|
|
|
return result.Dump(o << " -> ") << ' ' << EnumToString(rank);
|
|
|
|
}
|
|
|
|
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &IntrinsicProcTable::Implementation::Dump(
|
|
|
|
llvm::raw_ostream &o) const {
|
2018-10-13 07:01:55 +08:00
|
|
|
o << "generic intrinsic functions:\n";
|
2019-02-23 07:45:30 +08:00
|
|
|
for (const auto &iter : genericFuncs_) {
|
2018-10-13 07:01:55 +08:00
|
|
|
iter.second->Dump(o << iter.first << ": ") << '\n';
|
|
|
|
}
|
|
|
|
o << "specific intrinsic functions:\n";
|
2019-02-23 07:45:30 +08:00
|
|
|
for (const auto &iter : specificFuncs_) {
|
2018-10-13 07:01:55 +08:00
|
|
|
iter.second->Dump(o << iter.first << ": ");
|
|
|
|
if (const char *g{iter.second->generic}) {
|
|
|
|
o << " -> " << g;
|
|
|
|
}
|
|
|
|
o << '\n';
|
|
|
|
}
|
2019-09-17 07:58:13 +08:00
|
|
|
o << "subroutines:\n";
|
|
|
|
for (const auto &iter : subroutines_) {
|
|
|
|
iter.second->Dump(o << iter.first << ": ") << '\n';
|
|
|
|
}
|
2018-10-13 07:01:55 +08:00
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
2020-02-28 23:11:03 +08:00
|
|
|
llvm::raw_ostream &IntrinsicProcTable::Dump(llvm::raw_ostream &o) const {
|
2018-10-13 07:01:55 +08:00
|
|
|
return impl_->Dump(o);
|
|
|
|
}
|
2020-10-20 18:39:26 +08:00
|
|
|
|
|
|
|
// In general C846 prohibits allocatable coarrays to be passed to INTENT(OUT)
|
|
|
|
// dummy arguments. This rule does not apply to intrinsics in general.
|
|
|
|
// Some intrinsic explicitly allow coarray allocatable in their description.
|
|
|
|
// It is assumed that unless explicitly allowed for an intrinsic,
|
|
|
|
// this is forbidden.
|
|
|
|
// Since there are very few intrinsic identified that allow this, they are
|
|
|
|
// listed here instead of adding a field in the table.
|
|
|
|
bool AcceptsIntentOutAllocatableCoarray(const std::string &intrinsic) {
|
|
|
|
return intrinsic == "move_alloc";
|
|
|
|
}
|
2020-03-29 12:00:16 +08:00
|
|
|
} // namespace Fortran::evaluate
|