History log of /llvm-project-15.0.7/flang/lib/Semantics/expression.cpp (Results 1 – 25 of 118)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, 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, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, 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, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, 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, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init
# 7aa77c5a 23-Jul-2022 Kazu Hirata <[email protected]>

[flang] Fix a warning

This patch fixes:

llvm-project/flang/lib/Semantics/expression.cpp:405:12: error:
moving a local object in a return statement prevents copy elision
[-Werror,-Wpessimizing

[flang] Fix a warning

This patch fixes:

llvm-project/flang/lib/Semantics/expression.cpp:405:12: error:
moving a local object in a return statement prevents copy elision
[-Werror,-Wpessimizing-move]

show more ...


# e03664d4 22-Jul-2022 Peter Klausler <[email protected]>

[flang] Fix parsing and semantics for array element substring%KIND/%LEN

A type-param-inquiry of %KIND or %LEN applies to a designator, and
so must also be allowed for a substring. F18 presently (mi

[flang] Fix parsing and semantics for array element substring%KIND/%LEN

A type-param-inquiry of %KIND or %LEN applies to a designator, and
so must also be allowed for a substring. F18 presently (mis)parses
instances of a type-param-inquiry as structure component references
and then fixes them in expression semantics when types are known and
we can distinguish them. But when the base of a type-param-inquiry is
a substring of an array element, as in "charArray(i)(j:k)%len",
parsing fails.

Adjust the grammar to parse these cases, and extend expression semantics
to process the new production.

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

show more ...


# 23c2bedf 01-Jul-2022 Peter Klausler <[email protected]>

[flang] Establish a single source of target information for semantics

Create a TargetCharacteristics class to centralize the few items of
target specific information that are relevant to semantics.

[flang] Establish a single source of target information for semantics

Create a TargetCharacteristics class to centralize the few items of
target specific information that are relevant to semantics. Use the
new class for all target queries, including derived type component layout
modeling.

Future work will initialize this class with target information
provided or forwarded by the drivers, and use it to fold layout-dependent
intrinsic functions like TRANSFER().

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

Updates: Attempts to work around build issues on Windows.

show more ...


Revision tags: llvmorg-14.0.6
# bcad53e1 11-Jun-2022 Peter Klausler <[email protected]>

[flang] Add more qualification when creating names for compiler-generated USEs

When generic resolution finds its specific procedure in a module,
and that specific procedure is not use-associated int

[flang] Add more qualification when creating names for compiler-generated USEs

When generic resolution finds its specific procedure in a module,
and that specific procedure is not use-associated into the local scope
(perhaps because it was PRIVATE, perhaps because the generic was
use-associated with ONLY:), we create a new use-association with
a renaming. The name constructed for this renaming needs to be
additionally qualified with the module name of the specific procedure
in order to avoid clashing with another specific of the same name
that may have previously been use-associated in the same way from
a distinct module.

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

show more ...


# c6d8aa27 14-Jun-2022 Peixin-Qiao <[email protected]>

[flang] Add semantic check for multiple part-ref with nonzero rank for TBP

As Fortran 2018 C919, there shall not be more than one part-ref with
nonzero rank. Support this semantic check for type-bou

[flang] Add semantic check for multiple part-ref with nonzero rank for TBP

As Fortran 2018 C919, there shall not be more than one part-ref with
nonzero rank. Support this semantic check for type-bound procedure to
address the issue https://github.com/llvm/llvm-project/issues/55811.

Reviewed By: klausler

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

show more ...


Revision tags: llvmorg-14.0.5
# 48a70ea1 07-Jun-2022 Peixin-Qiao <[email protected]>

[flang] Fix semantic checks for C919

The previous semantic analysis does not consider when the last part-ref
is scalar or complex part. Refactor the previous code and bring all the
checks into one p

[flang] Fix semantic checks for C919

The previous semantic analysis does not consider when the last part-ref
is scalar or complex part. Refactor the previous code and bring all the
checks into one place. The check starts from the designator by
extracting the dataref wrapped including the substring and complex part
and recursively check the base objects.

Co-authored-by: Peter Klausler <[email protected]>

Reviewed By: klausler

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

show more ...


# f1983fea 27-May-2022 Emil Kieri <[email protected]>

[flang] Make extension explicit: exponent-letter matching kind-param

As an extension for REAL literals, we allow an exponent letter which
matches an explicit kind-param. The standard requires the ex

[flang] Make extension explicit: exponent-letter matching kind-param

As an extension for REAL literals, we allow an exponent letter which
matches an explicit kind-param. The standard requires the exponent
to be 'E' if a kind-param is present. This patch
- documents this extension in Extensions.md
- enables a portability warning if it is used with -pedantic

The test case for this, kinds05.f90, needs D125804, which makes
test_errors.py test warnings as well, to actually test the warnings.
I include it already now to keep things together, it will do no harm
(I hope ...).

We also add WARNING-directives to the test kinds04.f90 in preparation
for D125804. As the exponent-letter 'Q' does not imply the same kind
on all platforms, the emitted warnings are platform-dependent.
Therefore, the test is duplicated into two variants which are run
conditionally.

Finally, we promote the portability warning for when the exponent letter
is neither 'E' nor matching the kind-param to a standard warning.

Reviewed By: klausler

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

show more ...


# 0c190575 26-May-2022 Peter Klausler <[email protected]>

[flang] Make generic resolution conform to 15.5.5.2 w/r/t host association

When two or more generic interfaces are available by declaration or
by USE association at different scoping levels, we need

[flang] Make generic resolution conform to 15.5.5.2 w/r/t host association

When two or more generic interfaces are available by declaration or
by USE association at different scoping levels, we need to search
the outer generic interfaces as well as the inner ones, but only after
the inner ones have failed to produce a specific procedure that matches
a given set of actual arguments. This means that it is possible for
a specific procedure of a generic interface of an inner scope to override
a conflicting specific procedure of a generic interface of an outer
scope.

Also cope with forward references to derived types when a generic
interface is also in scope.

Fixes LLVM bug https://github.com/llvm/llvm-project/issues/55240 and
LLVM bug https://github.com/llvm/llvm-project/issues/55300.

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

show more ...


# 73506256 24-May-2022 Peter Klausler <[email protected]>

[flang] Avoid spurious warnings from reading module files

When processing the literal constants of the various kinds of
INTEGER that are too large by 1 (e.g., 2147483648_4) in expression
analysis, e

[flang] Avoid spurious warnings from reading module files

When processing the literal constants of the various kinds of
INTEGER that are too large by 1 (e.g., 2147483648_4) in expression
analysis, emit a portability warning rather than a fatal error if
the literal constant appears as the operand to a unary minus, since
the folded result will be in range. And don't emit any warning if
the negated literal is coming from a module file -- f18 wrote the
module file and the warning would simply be confusing, especially to
the programmer that wrote (-2147483647_4-1) in the first place.

Further, emit portability warnings for the canonical expressions for
infinities and NaN (-1./0., 0./0., & 1./0.), but not when they appear
in a module file, for the same reason. The Fortran language has no
syntax for these special values so we have to emit expressions that
fold to them.

Fixes LLVM bugs https://github.com/llvm/llvm-project/issues/55086 and
https://github.com/llvm/llvm-project/issues/55081.

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

show more ...


# bbad981d 25-May-2022 Peter Klausler <[email protected]>

[flang] Address regression (calls to assumed-length character function dummy procedures)

A recent fix beefed up semantics checking to catch the case of a call
to an external assumed-length character

[flang] Address regression (calls to assumed-length character function dummy procedures)

A recent fix beefed up semantics checking to catch the case of a call
to an external assumed-length character function; this check has false
positives in the case of an assumed-length character function that is
a dummy procedure. These do have a length that is passed in extra
compiler-created arguments. This patch refines the check and undoes some
changes to tests.

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

show more ...


Revision tags: llvmorg-14.0.4
# bd92bca5 19-May-2022 Peter Klausler <[email protected]>

[flang] Fix purity testing for generic calls

The purity or impurity of a call to a generic interface
depends on the attributes of the specific procedure or specific
binding. Change expression analy

[flang] Fix purity testing for generic calls

The purity or impurity of a call to a generic interface
depends on the attributes of the specific procedure or specific
binding. Change expression analysis of calls to generic interfaces
to replace the symbol in the parse tree with the specific procedure
or binding; this ensures that later checking for purity in
DO CONCURRENT and other contexts will be accurate.

Remove an "XFAIL" from a test that now passes again with this fix.

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

show more ...


# c4286209 18-May-2022 Peter Klausler <[email protected]>

[flang] Catch calls to assumed-length character functions

Semantics was allowing calls to CHARACTER(*) functions, which are odd
things -- they can be declared, and passed around, but can never actua

[flang] Catch calls to assumed-length character functions

Semantics was allowing calls to CHARACTER(*) functions, which are odd
things -- they can be declared, and passed around, but can never actually
be called as such. They must be redeclared with an explicit length that
ends up being passed as a hidden argument. So check for these calls
and diagnose them, add tests, and clean up some existing tests that
were in error and now get caught.

Possible TODO for lowering: there were some test cases that used
bad calls to assumed-length CHARACTER*(*) functions and validated
their implementations. I've removed some, and adjusted another,
but the code that somehow implemented these calls may need to be
removed and replaced with an assert about bad semantics.

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

show more ...


# 3a26596a 07-May-2022 Peter Klausler <[email protected]>

[flang] Fold complex component references

Complex component references (z%RE, z%IM) of complex named constants
should be evaluated at compilation time.

Differential Revision: https://reviews.llvm.o

[flang] Fold complex component references

Complex component references (z%RE, z%IM) of complex named constants
should be evaluated at compilation time.

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

show more ...


# d1344422 05-May-2022 Peter Steinfeld <[email protected]>

[flang][nfc] Use a message class for "not yet implemented" messages

Following a previous suggestion from Peter Klausler.

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


Revision tags: llvmorg-14.0.3, llvmorg-14.0.2
# b8a929cb 16-Apr-2022 Peter Klausler <[email protected]>

[flang] Fix regression with recent work on intrinsic/generic interactions

When resolving a procedure reference, do not allow a successful
intrinsic procedure probe result to override an existing
sym

[flang] Fix regression with recent work on intrinsic/generic interactions

When resolving a procedure reference, do not allow a successful
intrinsic procedure probe result to override an existing
symbol.

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

show more ...


Revision tags: llvmorg-14.0.1
# cd03e96f 23-Mar-2022 Peter Klausler <[email protected]>

[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 ...


# 9f5f2eb2 12-Apr-2022 Peter Klausler <[email protected]>

[flang] Accept %KIND type parameter inquiries on %RE,%IM, &c.

The x%KIND inquiry needs to be supported when 'x' is itself
a complex part reference or a type parameter inquiry.

Differential Revision

[flang] Accept %KIND type parameter inquiries on %RE,%IM, &c.

The x%KIND inquiry needs to be supported when 'x' is itself
a complex part reference or a type parameter inquiry.

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

show more ...


# 9e7eef99 13-Apr-2022 Peter Klausler <[email protected]>

[flang] Handle parameter-dependent types in PDT initializers

For parameterized derived type component initializers whose
expressions' types depend on parameter values, f18's current
scheme of analyz

[flang] Handle parameter-dependent types in PDT initializers

For parameterized derived type component initializers whose
expressions' types depend on parameter values, f18's current
scheme of analyzing the initialization expression once during
name resolution fails. For example,

type :: pdt(k)
integer, kind :: k
real :: component = real(0.0, kind=k)
end type

To handle such cases, it is necessary to re-analyze the parse
trees of these initialization expressions once for each distinct
initialization of the type.

This patch adds code to wipe an expression parse tree of its
typed expressions, and update those of its symbol table pointers
that reference type parameters, and then re-analyze that parse
tree to generate the properly typed component initializers.

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

show more ...


# eb14135e 04-Apr-2022 Peter Klausler <[email protected]>

[flang] Correct interaction between generics and intrinsics

Fortran allows a generic interface to have he same name as an
intrinsic procedure. If the intrinsic is explicitly marked with
the INTRINS

[flang] Correct interaction between generics and intrinsics

Fortran allows a generic interface to have he same name as an
intrinsic procedure. If the intrinsic is explicitly marked with
the INTRINSIC attribute, restrictions apply (C848) - the generic
must contain only functions or subroutines, depending on the
intrinsic. Explicit or not, the generic overrides the intrinsic,
but the intrinsic behavior must still be available for calls
whose actual arguments do not match any of the specific procedures.

Semantics was not checking constraint C848, and it didn't allow
an explicit INTRINSIC attribute on a name of a generic interface.

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

show more ...


# ef141aec 01-Apr-2022 Peter Klausler <[email protected]>

[flang] Improve appearance of message attachments

Error messages can have a list of attachments; these are used to point
to related source locations, supply additional information, and to
encapsulat

[flang] Improve appearance of message attachments

Error messages can have a list of attachments; these are used to point
to related source locations, supply additional information, and to
encapsulate error messages that were *not* emitted in a given context
to explain why a warning was justified.

This patch adds a message severity ("Because") for that last case,
and extends to AttachTo() API to provide a means for overriding
the severity of an attached message.

Some existing message attachments had their severities adjusted,
now that we're printing them. And operator==() for Message was
cleaned up while debugging after I noticed that it was recursively
O(N**2) and subject to returning a false positive.

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

show more ...


# 4ca111d4 28-Mar-2022 Andrzej Warzynski <[email protected]>

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 <[email protected]>

[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 ...


# 0363a164 23-Mar-2022 Peter Klausler <[email protected]>

[flang] Fix bogus error from assignment to CLASS(*)

Assignment semantics was coughing up bad errors and crashes for
intrinsic assignments to unlimited polymorphic entities while
looking for any (imp

[flang] Fix bogus error from assignment to CLASS(*)

Assignment semantics was coughing up bad errors and crashes for
intrinsic assignments to unlimited polymorphic entities while
looking for any (impossible) user defined ASSIGNMENT(=) generic
or intrinsic type conversion.

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

show more ...


# df209b80 23-Mar-2022 Peter Steinfeld <[email protected]>

[flang] Make not yet implemented messages more consistent

To make it easier to find things that are not yet implemented, I'm changing the
messages that appear in the compiler's output to all have th

[flang] Make not yet implemented messages more consistent

To make it easier to find things that are not yet implemented, I'm changing the
messages that appear in the compiler's output to all have the string "not yet
implemented:".

These changes apply to files in the front end. I have another set of changes
to files in the lowering code.

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

show more ...


Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3
# a53967cd 07-Mar-2022 Peter Klausler <[email protected]>

[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 ...


12345