#
96963554 |
| 14-Jan-2025 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Better messages and error recovery for a bad RESHAPE (#122604)
Add tests for negative array extents where necessary, motivated by a
compiler crash exposed by yet another fuzzer test, and im
[flang] Better messages and error recovery for a bad RESHAPE (#122604)
Add tests for negative array extents where necessary, motivated by a
compiler crash exposed by yet another fuzzer test, and improve overall
error message quality for RESHAPE().
Fixes https://github.com/llvm/llvm-project/issues/122060.
show more ...
|
#
17daa843 |
| 14-Nov-2024 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Better IS_CONTIGUOUS folding for substrings (#115970)
At present, the compiler doesn't analyze substring references for
contiguity. But there are cases where substrings can be known to be
[flang] Better IS_CONTIGUOUS folding for substrings (#115970)
At present, the compiler doesn't analyze substring references for
contiguity. But there are cases where substrings can be known to be
contiguous (scalar base, empty substring, or complete substring) or can
be known to be discontiguous, and references to the intrinsic function
IS_CONTIGUOUS in those cases may appear in constant expressions.
Fixes https://github.com/llvm/llvm-project/issues/115675.
show more ...
|
#
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 ...
|
#
d4524298 |
| 10-Sep-2024 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Fix shared library flang build (#108101)
I broke the shared library builds a few minutes ago by introducing a
cyclic dependency between two parts of the compiler. Fix.
|
#
26ac30bc |
| 10-Sep-2024 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Accept initialized SAVE local in specification expression (#107656)
Specification expressions may contain references to dummy arguments,
host objects, module variables, and variables in COM
[flang] Accept initialized SAVE local in specification expression (#107656)
Specification expressions may contain references to dummy arguments,
host objects, module variables, and variables in COMMON blocks, since
they will have values on entry to the scope. A local variable with a
initializer and the SAVE attribute (which will always be implied by an
explicit initialization) will also always work, and is accepted by at
least one other compiler, so accept it with a warning.
show more ...
|
#
7ea78643 |
| 08-Aug-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Improve error message output (#102324)
When a local character variable with non-constant length has an
initializer, it's an error in a couple of ways (SAVE variable with
unknown size, stat
[flang] Improve error message output (#102324)
When a local character variable with non-constant length has an
initializer, it's an error in a couple of ways (SAVE variable with
unknown size, static initializer that isn't constant due to conversion
to an unknown length). The error that f18 reports is the latter, but the
message contains a formatted representation of the initialization
expression that exposes a non-Fortran %SET_LENGTH() operation. Print the
original expression in the message instead.
show more ...
|
#
3602efa7 |
| 24-Jun-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Silence errors on C_LOC/C_FUNLOC in specification expressions (#96108)
Transformational functions from the intrinsic module ISO_C_BINDING are
allowed in specification expressions, so tweak
[flang] Silence errors on C_LOC/C_FUNLOC in specification expressions (#96108)
Transformational functions from the intrinsic module ISO_C_BINDING are
allowed in specification expressions, so tweak some general checks that
would otherwise trigger error messages about inadmissible targets, dummy
procedures in specification expressions, and pure procedures with impure
dummy procedures.
show more ...
|
#
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 ...
|
#
67081bad |
| 12-Jun-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Enforce F'2023 C15121 (#94418)
No specification expression in the declaration of the result variable of
an elemental function may depend on the value of a dummy argument. This
ensures that
[flang] Enforce F'2023 C15121 (#94418)
No specification expression in the declaration of the result variable of
an elemental function may depend on the value of a dummy argument. This
ensures that all of the results have the same type when the elemental
function is applied to the elements of an array.
show more ...
|
#
d1aa9bac |
| 03-Jun-2024 |
jeanPerier <jperier@nvidia.com> |
[flang] lower select rank (#93967)
Lower select rank according to [assumed-rank lowering design
doc](https://github.com/llvm/llvm-project/blob/main/flang/docs/AssumedRank.md).
The construct is l
[flang] lower select rank (#93967)
Lower select rank according to [assumed-rank lowering design
doc](https://github.com/llvm/llvm-project/blob/main/flang/docs/AssumedRank.md).
The construct is lowered using fir.box_rank and fir.select_case
operation and, for the non pointer/allocatable case, a
fir.is_assumed_size + conditional branch before the select_case to deal
with the assumed-size case.
The way the CFG logic is generated, apart from the extra conditional
branch for assumed-size, is similar to what is done for SELECT CASE
lowering, hence the sharing of the construct level visitor.
For the CFG parts. The main difference is that we need to keep track of
the selector to cook it and map it inside the cases (hence the new
members of the ConstructContext).
The only TODOs left are to deal with the RANK(*) case for polymorphic
entities and PDTs. I will do the polymorphic case in a distinct patch,
this patch has enough content.
Fortran::evaluate::IsSimplyContiguous change is needed to avoid generating
copy-in/copy-out runtime calls when passing the RANK(*) associating
entity to some implicit interface.
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 ...
|
#
e1ad2735 |
| 08-Apr-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Clean up ISO_FORTRAN_ENV, fix NUMERIC_STORAGE_SIZE (#87566)
Address TODOs in the intrinsic module ISO_FORTRAN_ENV, and extend the
implementation of NUMERIC_STORAGE_SIZE so that the calculat
[flang] Clean up ISO_FORTRAN_ENV, fix NUMERIC_STORAGE_SIZE (#87566)
Address TODOs in the intrinsic module ISO_FORTRAN_ENV, and extend the
implementation of NUMERIC_STORAGE_SIZE so that the calculation of its
value is deferred until it is needed so that the effects of
-fdefault-integer-8 or -fdefault-real-8 are reflected. Emit a warning
when NUMERIC_STORAGE_SIZE is used from the module file and the default
integer and real sizes do not match.
Fixes https://github.com/llvm/llvm-project/issues/87476.
show more ...
|
#
5a0382ce |
| 26-Mar-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Catch non-constant targets for procedure pointer initialization (#86338)
Detect attempts to use non-constant targets, including internal
procedures, as initializers for procedure pointers,
[flang] Catch non-constant targets for procedure pointer initialization (#86338)
Detect attempts to use non-constant targets, including internal
procedures, as initializers for procedure pointers, including components
of structure components being used as initializers.
show more ...
|
#
233f750c |
| 05-Mar-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Catch more bad pointer initialization targets (#83731)
A pointer variable initialization or pointer component default
initialization cannot reference another pointer.
Fixes https://githu
[flang] Catch more bad pointer initialization targets (#83731)
A pointer variable initialization or pointer component default
initialization cannot reference another pointer.
Fixes https://github.com/llvm/llvm-project/issues/82944.
show more ...
|
#
3d3c63da |
| 17-Jan-2024 |
Kelvin Li <kkwli@users.noreply.github.com> |
[flang] Add structure constructor with allocatable component (#77845)
Enable the structure constructor with allocatable component support.
Handling of `null()` for the allocatable component is add
[flang] Add structure constructor with allocatable component (#77845)
Enable the structure constructor with allocatable component support.
Handling of `null()` for the allocatable component is added.
show more ...
|
#
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 ...
|
#
51a2ac64 |
| 18-Oct-2023 |
jeanPerier <jperier@nvidia.com> |
[flang] Fold IS_CONTIGUOUS of component refs with non-contiguous base (#69327)
|
#
7e013d60 |
| 13-Sep-2023 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Accept intrinsic functions in DATA statement variables (#66229)
Pure intrinsic functions are acceptable in constant expressions so long
as their arguments are constant expressions. Allow th
[flang] Accept intrinsic functions in DATA statement variables (#66229)
Pure intrinsic functions are acceptable in constant expressions so long
as their arguments are constant expressions. Allow them to appear in
subscripts in DATA statement variables.
Fixes https://github.com/llvm/llvm-project/issues/65046.
show more ...
|
#
449823e2 |
| 02-Aug-2023 |
Slava Zakharin <szakharin@nvidia.com> |
[flang] Fixed IsContiguous check for slices of parameter arrays.
A section of a parameter array may be non-contiguous, so the current !IsVariable(expr) check is too optimistic to claim contiguity.
[flang] Fixed IsContiguous check for slices of parameter arrays.
A section of a parameter array may be non-contiguous, so the current !IsVariable(expr) check is too optimistic to claim contiguity.
This patch fixes issues with incorrect hlfir.designate op generated during lowering: the lowering queries IsContiguous to decide whether to use fir.box<fir.array> or plain fir.ref<fir.array> to represent the designator result.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D156494
show more ...
|
#
a88cee1f |
| 21-Apr-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Semantics for ISO_C_BINDING's C_LOC()
Make __builtin_c_loc() into an intrinsic function and verify the special semantic requirements on its actual arguments.
Differential Revision: https://
[flang] Semantics for ISO_C_BINDING's C_LOC()
Make __builtin_c_loc() into an intrinsic function and verify the special semantic requirements on its actual arguments.
Differential Revision: https://reviews.llvm.org/D149988
show more ...
|
#
6f5df419 |
| 14-Apr-2023 |
Jean Perier <jperier@nvidia.com> |
[flang] Fold IS_CONTIGUOUS for TYPE(*) when possible
TYPE(*) arguments fell through in IS_CONTIGUOUS folding because they are not Expr<SomeType>. Expose entry point for symbols in IsContiguous and u
[flang] Fold IS_CONTIGUOUS for TYPE(*) when possible
TYPE(*) arguments fell through in IS_CONTIGUOUS folding because they are not Expr<SomeType>. Expose entry point for symbols in IsContiguous and use that.
The added test revealed that IS_CONTIGUOUS was folded to false for assumed rank arguments. Fix this: the contiguity of assumed rank without the CONTIGUOUS argument can only be verified at runtime.
Differential Revision: https://reviews.llvm.org/D148128
show more ...
|
#
057b6fb6 |
| 25-Feb-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Fix CONTIGUOUS attribute for construct entities
Currently, the selector of a construct entity (e.g., ASSOCIATE(x=>a(1:20))) is inheriting the CONTIGUOUS attribute from its associated variabl
[flang] Fix CONTIGUOUS attribute for construct entities
Currently, the selector of a construct entity (e.g., ASSOCIATE(x=>a(1:20))) is inheriting the CONTIGUOUS attribute from its associated variable even if it has subscripts that make it noncontiguous (a(1:20:2)). Add construct entities to the dynamic contiguity predicate instead.
Differential Revision: https://reviews.llvm.org/D145114
show more ...
|
#
27004e02 |
| 01-Feb-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Fix build warning
It's basically impossible to write a switch statement with a case for every enumerator in an enum class if the cases each have a return statement and get it to compile with
[flang] Fix build warning
It's basically impossible to write a switch statement with a case for every enumerator in an enum class if the cases each have a return statement and get it to compile without warnings for all of our build compilers & versions. Rewrite as a sequence of if statements.
show more ...
|
#
ed2b70ea |
| 01-Feb-2023 |
Kazu Hirata <kazu@google.com> |
[flang] Fix a warning
This patch fixes:
flang/lib/Evaluate/check-expression.cpp:509:3: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
|
#
05e62db2 |
| 05-Jan-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Catch bad inquiries in specification expressions
When a descriptor inquiry or inquiry function's result is not constant and is known to be impossible to correctly determine at runtime, raise
[flang] Catch bad inquiries in specification expressions
When a descriptor inquiry or inquiry function's result is not constant and is known to be impossible to correctly determine at runtime, raise an error. For example, LEN(X) when X is a local allocatable variable with deferred length.
Differential Revision: https://reviews.llvm.org/D142759
show more ...
|