Revision tags: llvmorg-21-init, llvmorg-19.1.7 |
|
#
b8513e43 |
| 08-Jan-2025 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Better handling of weird pointer assignment case (#120628)
F'2023 C1017 permits the assignment of an unlimited polymorphic data
target to a monomorphic LHS pointer when the LHS pointer has
[flang] Better handling of weird pointer assignment case (#120628)
F'2023 C1017 permits the assignment of an unlimited polymorphic data
target to a monomorphic LHS pointer when the LHS pointer has a sequence
derived type (BIND(C) or SEQUENCE attribute). We allowed for this in
pointer assignments that don't have a function reference as their RHS.
Extend this support to function references, and also ensure that rank
compatibility is still checked.
show more ...
|
Revision tags: llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2 |
|
#
0f973ac7 |
| 02-Oct-2024 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Tag warnings with LanguageFeature or UsageWarning (#110304)
(This is a big patch, but it's nearly an NFC. No test results have
changed and all Fortran tests in the LLVM test suites work as
[flang] Tag warnings with LanguageFeature or UsageWarning (#110304)
(This is a big patch, but it's nearly an NFC. No test results have
changed and all Fortran tests in the LLVM test suites work as expected.)
Allow a parser::Message for a warning to be marked with the
common::LanguageFeature or common::UsageWarning that controls it. This
will allow a later patch to add hooks whereby a driver will be able to
decorate warning messages with the names of its options that enable each
particular warning, and to add hooks whereby a driver can map those
enumerators by name to command-line options that enable/disable the
language feature and enable/disable the messages.
The default settings in the constructor for LanguageFeatureControl were
moved from its header file into its C++ source file.
Hooks for a driver to use to map the name of a feature or warning to its
enumerator were also added.
To simplify the tagging of warnings with their corresponding language
feature or usage warning, to ensure that they are properly controlled by
ShouldWarn(), and to ensure that warnings never issue at code sites in
module files, two new Warn() member function templates were added to
SemanticsContext and other contextual frameworks. Warn() can't be used
before source locations can be mapped to scopes, but the bulk of
existing code blocks testing ShouldWarn() and FindModuleFile() before
calling Say() were convertible into calls to Warn(). The ones that were
not convertible were extended with explicit calls to
Message::set_languageFeature() and set_usageWarning().
show more ...
|
Revision tags: llvmorg-19.1.1 |
|
#
d5dd7d23 |
| 17-Sep-2024 |
Youngsuk Kim <youngsuk.kim@hpe.com> |
[flang] Tidy uses of raw_string_ostream (NFC)
As specified in the docs, 1) raw_string_ostream is always unbuffered and 2) the underlying buffer may be used directly
( 65b13610a5226b84889b923bae884b
[flang] Tidy uses of raw_string_ostream (NFC)
As specified in the docs, 1) raw_string_ostream is always unbuffered and 2) the underlying buffer may be used directly
( 65b13610a5226b84889b923bae884ba395ad084d for further reference )
Avoid unneeded calls to raw_string_ostream::str(), to avoid excess indirection.
show more ...
|
Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2 |
|
#
33c27f28 |
| 30-Jul-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Warn about undefined function results (#99533)
When the result of a function never appears in a variable definition
context, emit a warning.
If the function has multiple result variables
[flang] Warn about undefined function results (#99533)
When the result of a function never appears in a variable definition
context, emit a warning.
If the function has multiple result variables due to alternate ENTRY
statements, any definition will suffice.
The implementation of this check is tied to the general variable
definability checking utility in semantics. Every variable definition
context uses it to ensure that no undefinable variable is being defined.
A set of defined variables is maintained in the SemanticsContext and,
when the warning is enabled and no fatal error has been reported, the
scope tree is traversed and all the function subprograms' results are
tested for membership in that set.
show more ...
|
Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init |
|
#
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 ...
|
#
9ab292d7 |
| 24-Jun-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Add/fix some semantic checks for assumed-rank (#96194)
Catch some cases where assumed rank dummy arguments are not allowed.
|
#
73cf0142 |
| 24-Jun-2024 |
jeanPerier <jperier@nvidia.com> |
[flang] harden TypeAndShape for assumed-ranks (#96234)
SIZEOF and C_SIZEOF were broken for assumed-ranks because
`TypeAndShape::MeasureSizeInBytes` behaved as a scalar because the
`TypeAndShape::s
[flang] harden TypeAndShape for assumed-ranks (#96234)
SIZEOF and C_SIZEOF were broken for assumed-ranks because
`TypeAndShape::MeasureSizeInBytes` behaved as a scalar because the
`TypeAndShape::shape_` member was the same for scalar and assumed-ranks.
The easy fix would have been to add special handling in
`MeasureSizeInBytes` for assumed-ranks using the TypeAndShape
attributes, but I think this solution would leave `TypeAndShape::shape_`
manipulation fragile to future developers. Hence, I went for the
solution that turn shape_ into a `std::optional<Shape>`.
show more ...
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5 |
|
#
505f6da1 |
| 01-May-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Ensure all warning/portability messages are guarded by Should… (#90518)
…Warn()
Many warning messages were being emitted unconditionally. Ensure that
all warnings are conditional on a tr
[flang] Ensure all warning/portability messages are guarded by Should… (#90518)
…Warn()
Many warning messages were being emitted unconditionally. Ensure that
all warnings are conditional on a true result from a call to
common::LanguageFeatureControl::ShouldWarn() so that it is easy for a
driver to disable them all, or, in the future, to provide per-warning
control over them.
show more ...
|
#
cb263919 |
| 22-Apr-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Make proc characterization error conditional for generics (#89429)
When the characteristics of a procedure depend on a procedure that
hasn't yet been defined, the compiler currently emits a
[flang] Make proc characterization error conditional for generics (#89429)
When the characteristics of a procedure depend on a procedure that
hasn't yet been defined, the compiler currently emits an unconditional
error message. This includes the case of a procedure whose
characteristics depend, perhaps indirectly, on itself. However, in the
case where the characteristics of a procedure are needed to resolve a
generic, we should not emit an error for a hitherto undefined procedure
-- either the call will resolve to another specific procedure, in which
case the error is spurious, or it won't, and then an error will issue
anyway.
Fixes https://github.com/llvm/llvm-project/issues/88677.
show more ...
|
Revision tags: llvmorg-18.1.4, llvmorg-18.1.3 |
|
#
f546b6ef |
| 01-Apr-2024 |
harishch4 <harishcse44@gmail.com> |
[Flang] Relaxing an error when contiguous pointer is assigned to a non-contig… (#86781)
…uous function.
Fix from [thtsikas](https://github.com/thtsikas) based on a discussion
in
[slack](https:/
[Flang] Relaxing an error when contiguous pointer is assigned to a non-contig… (#86781)
…uous function.
Fix from [thtsikas](https://github.com/thtsikas) based on a discussion
in
[slack](https://flang-compiler.slack.com/archives/C5C58TT32/p1711124374836079).
Example:
```
Program test
Integer, Pointer, Contiguous :: cont(:)
Interface
Function f()
Integer, Pointer :: f(:)
End Function
End Interface
cont => f()
Print *, cont(3)
End Program
Function f()
Integer, Pointer :: f(:)
Allocate (f(4),Source=[1,1,42,1])
! f => f(4:1:-1) !! not contiguous, runtime error
End Function f
```
Understanding is that the standard intended to allow this pattern. The
restriction 10.2.2.3 p6 Data pointer assignment "If the pointer object
has the CONTIGUOUS attribute, the pointer target shall be contiguous."
is not associated with a numbered constraint. If there is a mechanism
for injecting runtime checks, this would be a place to do it. Absent
that, a warning is the best we can do.
No other compiler treats contigPtr => func() as an error when func() is
not CONTIGUOUS, so a warning would probably be better for consistency.
https://godbolt.org/z/5cM6roeEE
show more ...
|
Revision tags: llvmorg-18.1.2, llvmorg-18.1.1 |
|
#
1c530b3d |
| 01-Mar-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Whether a procedure's interface is explicit or not is not a d… (#82796)
…istinguishing characteristic
We note whether a procedure's interface is explicit or implicit as an
attribute of i
[flang] Whether a procedure's interface is explicit or not is not a d… (#82796)
…istinguishing characteristic
We note whether a procedure's interface is explicit or implicit as an
attribute of its characteristics, so that other semantics can be checked
appropriately, but this internal attribute should not be used as a
distinguishing characteristic in itself.
Fixes https://github.com/llvm/llvm-project/issues/81876.
show more ...
|
Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init |
|
#
e86591b3 |
| 30-Nov-2023 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Improve procedure interface compatibility checking for dummy … (#72704)
…arrays
When comparing dummy array extents, cope with references to symbols
better (including references to other
[flang] Improve procedure interface compatibility checking for dummy … (#72704)
…arrays
When comparing dummy array extents, cope with references to symbols
better (including references to other dummy arguments), and emit
warnings in dubious cases that are not equivalent but not provably
incompatible.
show more ...
|
Revision tags: llvmorg-17.0.6, llvmorg-17.0.5 |
|
#
1c91d9bd |
| 14-Nov-2023 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Ensure that portability warnings are conditional (#71857)
Before emitting a warning message, code should check that the usage in
question should be diagnosed by calling ShouldWarn(). A fair
[flang] Ensure that portability warnings are conditional (#71857)
Before emitting a warning message, code should check that the usage in
question should be diagnosed by calling ShouldWarn(). A fair number of
sites in the code do not, and can emit portability warnings
unconditionally, which can confuse a user that hasn't asked for them
(-pedantic) and isn't terribly concerned about portability *to* other
compilers.
Add calls to ShouldWarn() or IsEnabled() around messages that need them,
and add -pedantic to tests that now require it to test their portability
messages, and add more expected message lines to those tests when
-pedantic causes other diagnostics to fire.
show more ...
|
Revision tags: llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1 |
|
#
15c93766 |
| 18-Sep-2023 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Fix characterization of result of function returning procedur… (#66248)
…e pointer
The procedure characterization package correctly characterizes the
result of a reference to a function
[flang] Fix characterization of result of function returning procedur… (#66248)
…e pointer
The procedure characterization package correctly characterizes the
result of a reference to a function that returns a procedure pointer. In
the event of a result that is a pointer to a function that itself is a
procedure pointer, the code in pointer assignment semantics checking was
mistakenly using that result's procedure characteristics as the
characteristics of the original function reference. This is just wrong;
delete it.
show more ...
|
Revision tags: llvmorg-17.0.0 |
|
#
f82ee155 |
| 13-Sep-2023 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Don't check dummy vs. actual result rank for assumed-rank poi… (#66237)
…nters
When associating a function result pointer as an actual argument with a
dummy pointer that is assumed-rank,
[flang] Don't check dummy vs. actual result rank for assumed-rank poi… (#66237)
…nters
When associating a function result pointer as an actual argument with a
dummy pointer that is assumed-rank, don't emit a bogus error.
show more ...
|
Revision tags: llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3 |
|
#
0c0b2ea9 |
| 11-Aug-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Check procedure pointer initializations; clean up ELEMENTAL
Implements compatibility checking for initializers in procedure pointer declarations. This work exposed some inconsistency in how
[flang] Check procedure pointer initializations; clean up ELEMENTAL
Implements compatibility checking for initializers in procedure pointer declarations. This work exposed some inconsistency in how ELEMENTAL interfaces were handled and checked, from both unrestricted intrinsic functions and others, and some refinements needed for function result compatbility checking; these have also been ironed out. Some new warnings are now emitted, and this affected a dozen or so tests.
Differential Revision: https://reviews.llvm.org/D159026
show more ...
|
Revision tags: llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4 |
|
#
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 ...
|
Revision tags: llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1 |
|
#
50f1476a |
| 28-Mar-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Fix checking of pointer passed to assumed-rank
Don't check ranks when a pointer actual argument is associated with a pointer assumed-rank dummy argument.
Differential Revision: https://revi
[flang] Fix checking of pointer passed to assumed-rank
Don't check ranks when a pointer actual argument is associated with a pointer assumed-rank dummy argument.
Differential Revision: https://reviews.llvm.org/D147052
show more ...
|
Revision tags: llvmorg-16.0.0 |
|
#
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 ...
|
Revision tags: llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7 |
|
#
50960e93 |
| 03-Jan-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Catch character length errors in pointer associations
When character lengths are known at compilation time, report an error when a data target with a known length does not match the explicit
[flang] Catch character length errors in pointer associations
When character lengths are known at compilation time, report an error when a data target with a known length does not match the explicit length of a pointer that is being associated with it; see 10.2.2.3 paragraph 5.
Differential Revision: https://reviews.llvm.org/D142755
show more ...
|
#
fee041f6 |
| 01-Dec-2022 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Document and warn about an extension
Standard Fortran allows type-bound procedure bindings to only be called, and disallows them from being used in other contexts where a procedure name can
[flang] Document and warn about an extension
Standard Fortran allows type-bound procedure bindings to only be called, and disallows them from being used in other contexts where a procedure name can be: as the target of a procedure pointer assignment statement, and as an actual argument that corresponds to a dummy procedure. So long as the interfaces match, there's no good reason for these uses to be errors, and there some obvious use cases in polymorphic programming. So emit portability warnings rather than errors, and document this usage as an extension.
Differential Revision: https://reviews.llvm.org/D139127
show more ...
|
Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4 |
|
#
ad8f22c3 |
| 31-Oct-2022 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Rework line of code to dodge clang 16 warning
Recode a non-short-circuiting conjunction of two Boolean function calls into separate statements to avoid a warning from clang 16.
|
Revision tags: llvmorg-15.0.3 |
|
#
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 ...
|
#
bd28a0a5 |
| 24-Oct-2022 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Catch attempts to do anything with statement functions other than call them
A statement function in Fortran may be called, but it may not be the target of a procedure pointer or passed as an
[flang] Catch attempts to do anything with statement functions other than call them
A statement function in Fortran may be called, but it may not be the target of a procedure pointer or passed as an actual argument.
show more ...
|
Revision tags: working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2 |
|
#
b8641bfc |
| 03-Aug-2022 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Don't compute pointer component procedure characteristics when not needed
When a procedure pointer component has an interface that is a forward reference to a procedure, syntax errors can be
[flang] Don't compute pointer component procedure characteristics when not needed
When a procedure pointer component has an interface that is a forward reference to a procedure, syntax errors can be emitted if there is a structure constructor that tries to initialize that component, since its characteristics are not yet known; however, when the initializer is a bare NULL(with no mold), those characteristics don't matter. Make the characterization of the procedure pointer component take place only when needed.
Differential Revision: https://reviews.llvm.org/D131100
show more ...
|