History log of /llvm-project/flang/lib/Semantics/assignment.cpp (Results 1 – 20 of 20)
Revision Date Author Comments
# 07b3bba9 08-Jan-2025 Peter Klausler <pklausler@nvidia.com>

[flang] Allow LOCK_TYPE & al. to associate with INTENT(IN OUT) (#121413)

We're emitting a bogus semantic error message about an actual argument
being undefinable when associating LOCK_TYPE, EVENT_T

[flang] Allow LOCK_TYPE & al. to associate with INTENT(IN OUT) (#121413)

We're emitting a bogus semantic error message about an actual argument
being undefinable when associating LOCK_TYPE, EVENT_TYPE, and someday
NOTIFY_TYPE with an INTENT(IN OUT) dummy argument. These types indeed
make many definition contexts invalid, and the actual argument
associated with an INTENT(IN OUT) dummy argument must indeed be
definable, but the argument association itself is not a problem.

show more ...


# d5285fef 11-Jul-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang] Downgrade error message to a portability warning (#98368)

f18 current emits an error when an assignment is made to an array
section with a vector subscript, and the array is finalized with

[flang] Downgrade error message to a portability warning (#98368)

f18 current emits an error when an assignment is made to an array
section with a vector subscript, and the array is finalized with a
non-elemental final subroutine. Some other compilers emit this error
because (I think) they want variables to only be finalized in place, not
by a subroutine call involving copy-in & copy-out of the finalized
elements.

Since many other Fortran compilers can handle this case, and there's
nothing in the standards to preclude it, let's downgrade this error
message to a portability warning.

This patch got complicated because the API for the WhyNotDefinable()
utility routine was such that it would return a message only in error
cases, and there was no provision for returning non-fatal messages. It
now returns either nothing, a fatal message, or a non-fatal warning
message, and all of its call sites have been modified to cope.

show more ...


# 191d4872 09-May-2023 Peter Klausler <pklausler@nvidia.com>

[flang] Finer control over warnings

Establish a set of optional usage warnings, and enable some
only in "-pedantic" mode that, in our subjective experience
with application codes, seem to issue freq

[flang] Finer control over warnings

Establish a set of optional usage warnings, and enable some
only in "-pedantic" mode that, in our subjective experience
with application codes, seem to issue frequently without
indicating usage that really needs to be corrected. By default,
with this patch the compiler should appear to be somewhat less
persnickety but not less informative.

Differential Revision: https://reviews.llvm.org/D150710

show more ...


# 1fa9ef62 16-Mar-2023 Peter Klausler <pklausler@nvidia.com>

[flang] Consolidate and enhance pointer assignment checks

Consolidate aspects of pointer assignment & structure constructor pointer component
checking from Semantics/assignment.cpp and /expression.c

[flang] Consolidate and enhance pointer assignment checks

Consolidate aspects of pointer assignment & structure constructor pointer component
checking from Semantics/assignment.cpp and /expression.cpp into /pointer-assignment.cpp,
and add a warning about data targets that are not definable objects
but not hard errors. Specifically, a structure component pointer component data
target is not allowed to be a USE-associated object in a pure context by a numbered
constraint, but the right-hand side data target of a pointer assignment statement
has no such constraint, and that's the new warning.

Differential Revision: https://reviews.llvm.org/D146581

show more ...


# 61796236 29-Dec-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Don't apply intrinsic assignment check for PURE subprograms to defined assignment

A semantic constraint on assignments in PURE subprograms (C1594) applies
only to an intrinsic assignment and

[flang] Don't apply intrinsic assignment check for PURE subprograms to defined assignment

A semantic constraint on assignments in PURE subprograms (C1594) applies
only to an intrinsic assignment and should not be checked in the case of
a defined assignment.

Differential Revision: https://reviews.llvm.org/D142748

show more ...


# 962863d9 18-Nov-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Catch attempts to copy pointers in allocatables in PURE

In a pure context, a pointer acquired from an INTENT(IN) dummy argument
may not be copied. Catch the case in which the pointer is a c

[flang] Catch attempts to copy pointers in allocatables in PURE

In a pure context, a pointer acquired from an INTENT(IN) dummy argument
may not be copied. Catch the case in which the pointer is a component
of an allocatable component at some depth of nesting.

(This patch adds a new component iterator kind that is a variant of
a potential subobject component iterator; it visits all potential
subobject components, plus pointers, into which it does not descend.)

Differential Revision: https://reviews.llvm.org/D139161

show more ...


# 573fc618 17-Oct-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Fix pointer definition semantic checking via refactoring

The infrastructure in semantics that is used to check that the
left-hand sides of normal assignment statements are really definable
v

[flang] Fix pointer definition semantic checking via refactoring

The infrastructure in semantics that is used to check that the
left-hand sides of normal assignment statements are really definable
variables was not being used to check whether the LHSs of pointer assignments
are modifiable, and so most cases of unmodifiable pointers are left
undiagnosed. Rework the semantics checking for pointer assignments,
NULLIFY statements, pointer dummy arguments, &c. so that cases of
unmodifiable pointers are properly caught. This has been done
by extracting all the various definability checking code that has
been implemented for different contexts in Fortran into one new
facility.

The new consolidated definability checking code returns messages
meant to be attached as "because: " explanations to context-dependent
errors like "left-hand side of assignment is not definable".
These new error message texts and their attached explanations
affect many existing tests, which have been updated. The testing
infrastructure was extended by another patch to properly compare
warnings and explanatory messages, which had been ignored until
recently.

Differential Revision: https://reviews.llvm.org/D136979

show more ...


# e6373de5 26-Jul-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Allow assignment to host association in BLOCK in PURE subprogram

We need to distinguish BLOCK host association from subprogram host
association when checking assignments in PURE subprograms.

[flang] Allow assignment to host association in BLOCK in PURE subprogram

We need to distinguish BLOCK host association from subprogram host
association when checking assignments in PURE subprograms.
The specific case that is not allowed is an assignment to a variable
from the scope around the PURE subprogram.

Differential Revision: https://reviews.llvm.org/D131098

show more ...


# 2472b686 06-May-2022 PeixinQiao <qiaopeixin@huawei.com>

[flang] Add one semantic check for masked array assignment

As Fortran 2018 states, in each where-assignment-stmt, the mask-expr and
the variable being defined shall be arrays of the same shape. The

[flang] Add one semantic check for masked array assignment

As Fortran 2018 states, in each where-assignment-stmt, the mask-expr and
the variable being defined shall be arrays of the same shape. The
previous check does not consider checking if it is an array.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D125022

show more ...


# 7e225423 15-Apr-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Finer control over error recovery with GetExpr()

Prior to this patch, the semantics utility GetExpr() will crash
unconditionally if it encounters a typed expression in the parse
tree that ha

[flang] Finer control over error recovery with GetExpr()

Prior to this patch, the semantics utility GetExpr() will crash
unconditionally if it encounters a typed expression in the parse
tree that has not been set by expression semantics. This is the
right behavior when called from lowering, by which time it is known
that the program had no fatal user errors, since it signifies a
fatal internal error. However, prior to lowering, in the statement
semantics checking code, a more nuanced test should be used before
crashing -- specifically, we should not crash in the face of a
missing typed expression when in error recovery mode.

Getting this right requires GetExpr() and its helper class to have
access to the semantics context, so that it can check AnyFatalErrors()
before crashing. So this patch touches nearly all of its call sites.

Differential Revision: https://reviews.llvm.org/D123873

show more ...


# f187d64c 21-Jan-2021 peter klausler <pklausler@nvidia.com>

[flang][nfc] Fix comments, remove needless API, tweak script

* Remove an unimplemented and unused member function declaration
* Remove a misleading comment about an unrelated constraint number
* Fix

[flang][nfc] Fix comments, remove needless API, tweak script

* Remove an unimplemented and unused member function declaration
* Remove a misleading comment about an unrelated constraint number
* Fix a comment
* Add f18 crash message to "flang" driver script

Differential Revision: https://reviews.llvm.org/D95180

show more ...


# 88afb6e8 01-Oct-2020 peter klausler <pklausler@nvidia.com>

[flang] Semantic checks for bad usage of whole assumed-size arrays

The semantics pass currently checks for several constraints
that apply to the use of whole assumed-size arrays in various
contexts,

[flang] Semantic checks for bad usage of whole assumed-size arrays

The semantics pass currently checks for several constraints
that apply to the use of whole assumed-size arrays in various
contexts, but C1002 wasn't really implemented. This patch
implements C1002 by disallowing the use of whole assumed-size
arrays in expressions and variables unless specifically
allowed by the context. This centralizes the error reporting,
which has been improved with a link to the array's declaration.

Differential revision: https://reviews.llvm.org/D88691

show more ...


# 0e9e06a6 06-Aug-2020 peter klausler <pklausler@nvidia.com>

[flang][NFC] Reformat files with current clang-format

Differential Revision: https://reviews.llvm.org/D85489


# 70ad73b6 19-Apr-2020 sameeran joshi <sameeranjayant.joshi@amd.com>

[flang] Semantics for SELECT TYPE

Summary:
Added support for all semantic checks except C1157
was previously implemented.

Address review comments.

Reviewers: PeteSteinfeld, tsk

[flang] Semantics for SELECT TYPE

Summary:
Added support for all semantic checks except C1157
was previously implemented.

Address review comments.

Reviewers: PeteSteinfeld, tskeith, klausler, DavidTruby, kiranktp, anchu-rajendran, sscalpone

Subscribers: kiranchandramohan, llvm-commits, flang-commits

Tags: #llvm, #flang

Differential Revision: https://reviews.llvm.org/D79851

show more ...


# 76d71354 04-Apr-2020 Tim Keith <tkeith@nvidia.com>

[flang] Add message formatting for std::int64_t

There is no printf formatting string for std::int64_t. Instead we have
to cast to std::intmax_t and use `%jd`. This change simplifies that by
automati

[flang] Add message formatting for std::int64_t

There is no printf formatting string for std::int64_t. Instead we have
to cast to std::intmax_t and use `%jd`. This change simplifies that by
automatically converting std::int64_t to std::intmax_t when formatting
messages.

Original-commit: flang-compiler/f18@8a2343dfffc9ccb04bdfe4c16ca47128255d47bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/1101
Tree-same-pre-rewrite: false

show more ...


# 84a099df 27-Mar-2020 peter klausler <pklausler@nvidia.com>

[flang] Fix missing substring bounds (bug flang-compiler/f18#1091)

Original-commit: flang-compiler/f18@3b0c150b2e4d194cb5a46b40f41b3be59ef5fa51
Reviewed-on: https://github.com/flang-compiler/f18/pul

[flang] Fix missing substring bounds (bug flang-compiler/f18#1091)

Original-commit: flang-compiler/f18@3b0c150b2e4d194cb5a46b40f41b3be59ef5fa51
Reviewed-on: https://github.com/flang-compiler/f18/pull/1093

show more ...


# a40dbe7c 10-Mar-2020 Tim Keith <tkeith@nvidia.com>

[flang] Allow for vector subscript on LHS of assignment

Original-commit: flang-compiler/f18@38aefd41f051546024ecf4555a3bb3385b99f3c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/1062


# a0a1f519 06-Mar-2020 Tim Keith <tkeith@nvidia.com>

[flang] Perform definability checks on LHS of assignment

If the pure context check succeeds, call `WhyNotModifiable` to verify
the LHS can be modified.

Detect assignment to whole assumed-size array

[flang] Perform definability checks on LHS of assignment

If the pure context check succeeds, call `WhyNotModifiable` to verify
the LHS can be modified.

Detect assignment to whole assumed-size array.

Change `IsVariable` to return false for a parameter or a component or
array reference whose base it a parameter.

When analyzing an assignment statement, report an error if the LHS is
a constant expression. Otherwise it might get folded and when we detect
the problem later the error will be confusing.

Handle Substring on LHS of assignment. Change ExtractDataRef and IsVariable
to work on a Substring.

Fix IsImpliedShape and IsAssumedSize predicates in ArraySpec.

Fix C709 check in check-declarations.cpp.

Original-commit: flang-compiler/f18@f2d2657aab051b938ec4e4702926aadb436c19aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/1050

show more ...


# c97e1c0a 05-Mar-2020 Tim Keith <tkeith@nvidia.com>

[flang] Change CheckDefinabilityInPureScope to return bool

Have CheckDefinabilityInPureScope and CheckCopyabilityInPureScope return
false when their checks fail and report errors so that we will be

[flang] Change CheckDefinabilityInPureScope to return bool

Have CheckDefinabilityInPureScope and CheckCopyabilityInPureScope return
false when their checks fail and report errors so that we will be able
to avoid reporting extra errors in those cases.

Original-commit: flang-compiler/f18@305a3470e572161483b0f430514b77ba19f932ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/1050
Tree-same-pre-rewrite: false

show more ...


# 64ab3302 25-Feb-2020 CarolineConcatto <51754594+CarolineConcatto@users.noreply.github.com>

[flang] [LLVMify F18] Compiler module folders should have capitalised names (flang-compiler/f18#980)

This patch renames the modules in f18 to use a capital letter in the
module name

Signed-off-b

[flang] [LLVMify F18] Compiler module folders should have capitalised names (flang-compiler/f18#980)

This patch renames the modules in f18 to use a capital letter in the
module name

Signed-off-by: Caroline Concatto <caroline.concatto@arm.com>

Original-commit: flang-compiler/f18@d2eb7a1c443d1539ef12b6f027074a0eb15b1ea0
Reviewed-on: https://github.com/flang-compiler/f18/pull/980

show more ...