#
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 ...
|
#
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 ...
|
#
f89d2beb |
| 18-Sep-2023 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Prioritize DATA object error messages a little better (#66258)
When a DATA statement object is not valid, there's a number of possible
reasons. Emit an error message for the most egregious
[flang] Prioritize DATA object error messages a little better (#66258)
When a DATA statement object is not valid, there's a number of possible
reasons. Emit an error message for the most egregious violation, so that
an unlucky user doesn't fix something easy (due to a less-severe error
message masking one that is worse) and then run into something that
might be more serious.
show more ...
|
#
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 ...
|
#
27cf6ba1 |
| 19-Apr-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang][runtime] Initialize uninitialized pointer components
Pointer components without default initialization pose some difficult (or impossible) problems when they appear as right-hand side target
[flang][runtime] Initialize uninitialized pointer components
Pointer components without default initialization pose some difficult (or impossible) problems when they appear as right-hand side targets in pointer assignment statements; they may contain garbage or stale data that looks enough like a valid descriptor to cause a crash. Solve the problem by avoiding it -- ensure that pointers' descriptors are at least minimally established.
Differential Revision: https://reviews.llvm.org/D149979
show more ...
|
#
1eb9948f |
| 16-Mar-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Catch more bad DATA statement objects
The data statement variable checker is missing some cases, like expressions that are not variables. Run the checker first to enjoy its very specific er
[flang] Catch more bad DATA statement objects
The data statement variable checker is missing some cases, like expressions that are not variables. Run the checker first to enjoy its very specific error messages, but when it finds no problems, still apply a general check that an expression is a "variable" and also not a constant expression at the top level as a backstop.
Differential Revision: https://reviews.llvm.org/D146580
show more ...
|
#
cd03e96f |
| 23-Mar-2022 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Add & use a better visit() (take 2)
Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit().
[flang] Add & use a better visit() (take 2)
Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit().
The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time.
Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit().
Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work.
This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit().
show more ...
|
#
4ca111d4 |
| 28-Mar-2022 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
Revert "[flang] Add & use a better visit()"
This reverts commit 2ab9990c9eb79682a4d4b183dfbc7612d3e55328. It has caused multiple build failures: * https://lab.llvm.org/buildbot/#/builders/177/build
Revert "[flang] Add & use a better visit()"
This reverts commit 2ab9990c9eb79682a4d4b183dfbc7612d3e55328. It has caused multiple build failures: * https://lab.llvm.org/buildbot/#/builders/177/builds/4346 * https://lab.llvm.org/buildbot/#/builders/180/builds/3803 * https://lab.llvm.org/buildbot/#/builders/175/builds/10419 * https://lab.llvm.org/buildbot/#/builders/191/builds/4318 * https://lab.llvm.org/buildbot/#/builders/173/builds/4274 * https://lab.llvm.org/buildbot/#/builders/181/builds/4297
All these bots failed with a time-out: ``` command timed out: 1200 seconds without output running [b'ninja', b'-j', b'32'], attempting to kill ``` I'm guessing that that's due to template instantiations failing at some point (https://reviews.llvm.org/D122441 introduced a custom implementation of std::visit). Everything seems fine when either: * building on X86 with GCC or Clang (tested with GCC 9.3 and Clang 12) * building on AArch64 with GCC (tested with GCC 11)
show more ...
|
#
2ab9990c |
| 23-Mar-2022 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Add & use a better visit()
Adds flang/include/flang/Common/visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most
[flang] Add & use a better visit()
Adds flang/include/flang/Common/visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit().
The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time.
Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit().
Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work.
Differential Revision: https://reviews.llvm.org/D122441
show more ...
|
#
a53967cd |
| 07-Mar-2022 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Distinguish usage and portability warning messages
Using recently established message severity codes, upgrade non-fatal messages to usage and portability warnings as appropriate.
Differenti
[flang] Distinguish usage and portability warning messages
Using recently established message severity codes, upgrade non-fatal messages to usage and portability warnings as appropriate.
Differential Revision: https://reviews.llvm.org/D121246
show more ...
|
#
c4f67ea1 |
| 07-Feb-2022 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Allow DATA initialization of derived types w/ allocatable components
While one cannot of course statically initialize an allocatable component of an instance of a derived type, its mere pres
[flang] Allow DATA initialization of derived types w/ allocatable components
While one cannot of course statically initialize an allocatable component of an instance of a derived type, its mere presence should not prevent DATA initialization of the other nonallocatable components. Semantics was treating the existence of an allocatable component as a case of "default initialization", which it is, but not one that should run afoul of C877. Add another Boolean argument to IsInitialized() to allow for a more nuanced test.
Differential Revision: https://reviews.llvm.org/D119449
show more ...
|
#
63a2987d |
| 30-Dec-2021 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Allow initialization in blank COMMON
This is nonconformant usage, but widely accepted as an extension. Downgrade the error message to a warning.
Differential Revision: https://reviews.llvm.
[flang] Allow initialization in blank COMMON
This is nonconformant usage, but widely accepted as an extension. Downgrade the error message to a warning.
Differential Revision: https://reviews.llvm.org/D117152
show more ...
|
#
c14cf92b |
| 18-Dec-2021 |
Peter Klausler <pklausler@nvidia.com> |
[flang] Implement semantics for DEC STRUCTURE/RECORD
Implements part of the legacy "DEC structures" feature from VMS Fortran. STRUCTUREs are processed as if they were derived types with SEQUENCE.
[flang] Implement semantics for DEC STRUCTURE/RECORD
Implements part of the legacy "DEC structures" feature from VMS Fortran. STRUCTUREs are processed as if they were derived types with SEQUENCE. DATA-like object entity initialization is supported as well (e.g., INTEGER FOO/666/) since it was used for default component initialization in structures. Anonymous components (named %FILL) are also supported.
These features, and UNION/MAP, were already being parsed. An omission in the collection of structure field names in the case of nested structures with entity declarations was fixed in the parser.
Structures are supported in modules, but this is mostly for testing purposes. The names of fields in structures accessed via USE association cannot appear with dot notation in client code (at least not yet). DEC structures antedate Fortran 90, so their actual use in applications should not involve modules.
This patch does not implement UNION/MAP, since that feature would impose difficulties later in lowering them to MLIR types. In the meantime, if they appear, semantics will issue a "not yet implemented" error message.
Differential Revision: https://reviews.llvm.org/D117151
show more ...
|
#
57705df2 |
| 14-Sep-2021 |
peter klausler <pklausler@nvidia.com> |
[flang] Catch error: base of DATA statement object can't be a pointer
A pointer with subscripts, substring indices, or components cannot be initialized by a DATA statement (although of course a whol
[flang] Catch error: base of DATA statement object can't be a pointer
A pointer with subscripts, substring indices, or components cannot be initialized by a DATA statement (although of course a whole pointer can be so). Catch the missing cases.
Differential Revision: https://reviews.llvm.org/D109931
show more ...
|
#
7f8da079 |
| 31-Mar-2021 |
peter klausler <pklausler@nvidia.com> |
[flang] Refine checks for pointer initialization targets
f18 was emitting a bogus error message about the lack of a TARGET attribute when a pointer was initialized with a component of a variable tha
[flang] Refine checks for pointer initialization targets
f18 was emitting a bogus error message about the lack of a TARGET attribute when a pointer was initialized with a component of a variable that was a legitimate TARGET.
Differential Revision: https://reviews.llvm.org/D99665
show more ...
|
#
4ac617f4 |
| 07-Aug-2020 |
peter klausler <pklausler@nvidia.com> |
[flang] Handle DATA initialization of EQUIVALENCE'd objects
Objects that are storage associated by EQUIVALENCE and initialized with DATA are initialized by creating a compiler temporary data object
[flang] Handle DATA initialization of EQUIVALENCE'd objects
Objects that are storage associated by EQUIVALENCE and initialized with DATA are initialized by creating a compiler temporary data object in the same scope, assigning it an offset, type, and size that covers the transitive closure of the associated initialized original symbols, and combining their initializers into one common initializer for the temporary.
Some problems with offset assignment of EQUIVALENCE'd objects in COMMON were exposed and corrected, and some more error cases are checked.
Remove obsolete function. Small bugfix (nested implied dos). Add a test. Fix struct/class warning.
Differential Revision: https://reviews.llvm.org/D85560
show more ...
|
#
43b304b0 |
| 07-Aug-2020 |
peter klausler <pklausler@nvidia.com> |
[flang] Support DATA statement initialization of numeric with Hollerith/CHARACTER
This is a common Fortran language extension.
Differential Revision: https://reviews.llvm.org/D85492
|
#
dd904082 |
| 01-Jul-2020 |
Tim Keith <tkeith@nvidia.com> |
[flang][NFC] Get formatting in sync with latest clang-format
flang/module only contains Fortran files and one is a .h so disable formatting on that directory.
Differential Revision: https://reviews
[flang][NFC] Get formatting in sync with latest clang-format
flang/module only contains Fortran files and one is a .h so disable formatting on that directory.
Differential Revision: https://reviews.llvm.org/D82989
show more ...
|
#
a20d48d7 |
| 19-Jun-2020 |
peter klausler <pklausler@nvidia.com> |
[flang] DATA stmt processing (part 4/4): Check & convert DATA
Implement rest of DATA statement semantics and conversion of DATA statement initializations into static initializers of objects in their
[flang] DATA stmt processing (part 4/4): Check & convert DATA
Implement rest of DATA statement semantics and conversion of DATA statement initializations into static initializers of objects in their symbol table entries.
Reviewed By: tskeith, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D82207
show more ...
|
#
4171f80d |
| 19-Jun-2020 |
peter klausler <pklausler@nvidia.com> |
[flang] DATA stmt processing (part 3/4): Remaining prep work
Rolls up small changes across the frontend to prepare for the large forthcoming patch (part 4/4) that completes DATA statement processing
[flang] DATA stmt processing (part 3/4): Remaining prep work
Rolls up small changes across the frontend to prepare for the large forthcoming patch (part 4/4) that completes DATA statement processing via conversion to initializers.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D82137
show more ...
|
#
70f1b4b4 |
| 03-Jun-2020 |
Anchu Rajendran <asudhaku@amd.com> |
[flang] Implemented 2 Semantic checks for DATA statement and fixed a few bugs
Summary - Implemented C876, C877 - Fixed IsConstantExpr to check C879 - Fixed bugs in few test cases - data01.f90,
[flang] Implemented 2 Semantic checks for DATA statement and fixed a few bugs
Summary - Implemented C876, C877 - Fixed IsConstantExpr to check C879 - Fixed bugs in few test cases - data01.f90, block-data01.f90, pre-fir-tree02.f90 - Modified implementation of C8106 to identify all automatic objects and modified equivalence01.f90 to reflect the changes
Differential Revision: https://reviews.llvm.org/D78424
show more ...
|
#
3a1afd8c |
| 24-Apr-2020 |
peter klausler <pklausler@nvidia.com> |
Rework DATA statement semantics to use typed expressions
Summary: Updates recent work on DATA statement semantic checking in flang/lib/Semantics/check-data.{h,cpp} to use the compiler's internal rep
Rework DATA statement semantics to use typed expressions
Summary: Updates recent work on DATA statement semantic checking in flang/lib/Semantics/check-data.{h,cpp} to use the compiler's internal representation for typed expressions rather than working on the raw parse tree. Saves the analyzed expressions for DATA statement values as parse tree decorations because they'll soon be needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors are not constant expressions if they set an allocatable component to anything other than NULL.
Includes infrastructure changes to make this work, some renaming to reflect the fact that the implied DO loop indices tracked by expression analysis are not (just) from array constructors, remove some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
show more ...
|
#
c1c01212 |
| 18-Apr-2020 |
Anchu Rajendran <asudhaku@amd.com> |
[flang]Implemented Semantic Checkes for 5 data constraints
Summary: C874, C875, C878, C880 and C881 checks are implemented.
Differential Revision: https://reviews.llvm.org/D78008
|
#
1f879005 |
| 29-Mar-2020 |
Tim Keith <tkeith@nvidia.com> |
[flang] Reformat with latest clang-format and .clang-format
Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094
|
#
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 ...
|