Remove all inline links to Intel and IBM compiler options from the
comparison tables, as these links have become stale (Intel links
redirect to generic pages, IBM links redirect to PDF-only pages).
Option names are preserved for readability. The Data sources section
still contains links to the main documentation pages.
Details:
- Removed 43 Intel compiler option links
- Removed 35 IBM compiler option links
- Removed 2 stale links in notes section
- Updated documentation text accordingly
Fixes#171464
---------
Co-authored-by: Tarun Prabhu <tarun@lanl.gov>
The LOC intrinsic allows a cray pointer to alias with ordinary variables
with no other attribute. See the new test for an example.
This is not enabled by default. The functionality can be used with
`-mmlir -funsafe-cray-pointers`.
First part of the un-revert of #169544. That will handle TBAA.
...unless the reader is going to contribute to Flang.
Fixes#168911.
In which someone followed the getting started instructions but because
they were using GCC and it produced some warnings, those got upgraded to
errors and failed the build.
The GCC builds of anything in LLVM are always going to have some warning
of some kind, so while it would be nice to fix or silence them, let's
not inflict that on new developers.
This option defaults to `OFF` and is turned `ON` by a handful of bots,
so if the intent was to make developers more attentive to warnings, that
will still happen. Just a bit later, which that's better than putting
them off up front.
If they go on to contribute, they can switch to a Clang build and enable
the option to save themselves some post-commit hassle.
This document was written when Flang was known as F18 and Classic Flang
was known as Flang. The term "Flang" in this document refers to Classic
Flang, except in the first paragraph.
Also, a trivial HTML error is fixed.
Reformat the in-progress warning message in the release notes page. This
is now rendered in a style similar to that of clang. The warning will
be hidden on release builds of the documentation.
This is a reapply the original patch (#169137) with the flang-rt unit
test changes limiting it to linux platform only.
Additionally accommodated style changes from Peter Klausler (#170227)
show_descriptor intrinsic prints details of a descriptor (extended
Fortran pointer).
It accepts a descriptor for any type and rank, including scalars.
Requires use of flang_debug module.
Example:
```
program test
use flang_debug
implicit none
integer :: a(4) = (/ 1,3,5,7 /)
call show_descriptor(a(1:3))
end program test
```
and its output:
```
Descriptor @ 0x7ffe01ec6a98:
base_addr 0x563b7035103c
elem_len 4
version 20240719
rank 1
type 9 "INTEGER(kind=4)"
attribute 0
extra 0
addendum 0
alloc_idx 0
```
The title of the release notes page always showed "|version|
(In-Progress)". This has been fixed so the release version is shown as
expected. '(In-Progress)' is now only shown on non-release branches.
Unlike clang, flang does not use ${LLVM_VERSION_SUFFIX}, so even on
non-release branches the 'git' suffix will not be shown.
show_descriptor intrinsic prints details of a descriptor (extended
Fortran pointer).
It accepts a descriptor for any type and rank, including scalars.
Requires use of flang_debug module.
Example:
program test
use flang_debug
implicit none
integer :: a(4) = (/ 1,3,5,7 /)
call show_descriptor(a(1:3))
end program test
and its output:
Descriptor @ 0x7ffe01ec6a98:
base_addr 0x563b7035103c
elem_len 4
version 20240719
rank 1
type 9 "INTEGER(kind=4)"
attribute 0
extra 0
addendum 0
alloc_idx 0
dim[0] lower_bound 1
extent 3
sm 4
Previously `FLUSH` was only recognized in statement form (e.g.
`flush(unit)`); a
subroutine invocation `call flush(unit)` was treated as a generic user
call with
no special semantics. This change teaches lowering/semantics to handle
`CALL FLUSH` equivalently.
Fixes#119418
After the merging of #152736, there are a number of OpenMP Features that
are now fully supported. Missing from the initial patch was changing the
status of this from `P` to `Y` to indicate they are now fully supported.
The notes around not supporting `dist_schedule` were removed in the
initial patch.
`dist_schedule` was previously supported in Flang/Clang but was not
implemented in MLIR, instead a user would get a "not yet implemented"
error. This patch adds support for the `dist_schedule` clause to be
lowered to LLVM IR when used in an `omp.distribute` or `omp.wsloop`
section.
There has needed to be some rework required to ensure that MLIR/LLVM
emits the correct Schedule Type for the clause, as it uses a different
schedule type to other OpenMP directives/clauses in the runtime library.
This patch also ensures that when using dist_schedule or a chunked
schedule clause, the correct llvm loop parallel accesses details are
added.
The ISO Fortran standards don't say whether a WRITE to a formatted
stream unit should truncate the unit if there has been any repositioning
(via POS= control list specifiers) to an earlier point in the stream.
But units with sequential records do truncate on writes after BACKSPACE
and REWIND statements, and many compilers (including this one) truncate
stream units too. Since some compilers don't truncate streams, this
patch adds an environment variable FORT_TRUNCATE_STREAM that can be set
to 0 to disable truncation and ease porting to flang-new of codes that
depend on that behavior.
Fixes https://github.com/llvm/llvm-project/issues/167569.
Scalars with VALUE attribute are likely passed in registers, so it's now
clear what lowering should do with the array actual argument in this
case. Fail this case with an error before getting to lowering.
This relands #167348.
The original PR was reverted due to a reported build failure, which was
later diagnosed as a local issue in the developer’s checkout or build
state. See discussion here:
https://github.com/llvm/llvm-project/pull/163659#discussion_r2511546964
No additional changes have been made in this reland.
This change moves option-related code from clangDriver into a new
clangOptions library.
This refactoring is part of a broader effort to support driver-managed
builds for compilations using C++ named modules and/or Clang modules.
It is required for linking the dependency scanning tooling against the
driver without introducing cyclic dependencies, which would otherwise
cause build failures when dynamic linking is enabled.
In particular, clangFrontend must no longer depend on clangDriver
for this to be possible.
This PR is motivated by the following review comment:
https://github.com/llvm/llvm-project/pull/152770#discussion_r2430756918
Implementation details:
* Recognize prefetch directive in the parser as `!dir$ prefetch ...`
* Unparse the prefetch directive
* Add required tests
Details on the prefetch directive:
`!dir$ prefetch designator[, designator]...`, where the designator list
can be a variable or an array reference. This directive is used to
insert a hint to the code generator to prefetch instructions for
memory references.
PROCEDURE() declares a procedure with no interface or result type. (When
used to declare a derived type component, it must also be a NOPASS
POINTER.) Document that we allow such procedures to be called as
subroutines with implicit interfaces, despite the ISO standard -- this
is a universal extension to the language.
However, no longer allow such procedure entities to be referenced as
implicitly-typed functions -- this usage is neither portable nor
well-defined, as the compilers that do allow it do not respect the
implicit typing rules established at the point of declaration.
Implemented IGNORE_TKR(P), which allows ignoring pointer and allocatable
matching (can pass an allocatable array to routine with pointer array
argument and vice versa). Updated documentation.
This patch adds the support of these two directives : `!dir$ inline` and
`!dir$ noinline`.
- `!dir$ noinline` tells to the compiler to not perform inlining on
specific function calls by adding the `noinline` metadata on the call.
- `!dir$ inline` tells to the compiler to attempt inlining on specific
function calls by adding the `inlinehint` metadata on the call.
- `!dir$ forceinline` tells to the compiler to always perfom inlining on
specific function calls by adding the `alwaysinline` metadata on the
call.
Currently, these directives can be placed before a `DO LOOP`, call
functions or assignments. Maybe other statements can be added in the
future if needed.
For the `inline` directive the correct name might be `forceinline` but
I'm not sure ?
IntrinsicTypes.md has not been edited because, at the time that this PR was posted, there was another open PR updating that file. The replacement of f18 with flang will either be performed as part of that PR, or in a later commit.
In addition to the replacement, some light editing of the text was also
carried out. These edits primarily address issues of grammar and
style.
The remaining references to "f18" will be replaced in a later commit.
Originally #161912, we've now decided that an explicit GPL notification
is redundant with the LICENSE file, which is a common convention for
relaying this information.
Co-authored-by: Cameron McInally <cmcinally@nvidia.com>
The technical call has been cancelled, so that text has been removed.
The description of the "general" call has been updated to indicate that
it is intended for both technical and general discussions.
Audit the use of std::optional<bool> as a tri-state logical value in
flang, correct a couple cases that need ".value_or()", add some explicit
".has_value()" calls, and document the possible pitfalls.
Add a GPL notice to the GFortran test suite documentation and redirect
to the LICENSE file distributed with the test suite.
Co-authored-by: Cameron McInally <cmcinally@nvidia.com>
This patch accelerates complex division by passing
`-complex-range=basic` to the frontend when the `-ffast-math` option is
specified. This behavior is the same as `-fcomplex-arithmetic=basic`. A
warning is issued if a different value is specified for
`-fcomplex-arithmetic=`. The warning conditions will be unified with
clang.
Whether list-directed child READ statements should be allowed to advance
to further records is neither explicit in the standard nor consistent in
existing Fortran implementations. We allow child namelist READ
statements to advance, but not other list- directed child input.
This patch refines our interpretation of this case. Child namelist READ
statements continue to be able to advance; in addition, non-namelist
child READ statements can now advance if their parent READ statement is
a list-directed input statement at the top level, or a child that could.
But non-namelist list-directed child input taking place in a context
with explicit format control won't advance to following records, so that
the format-controlled parent READ statement can retain control over
record advancement.
Also corrects two cases of record repositioning in numeric input
editing, which were failing under child input because they weren't
allowing for left tab limits.
Fixes https://github.com/llvm/llvm-project/issues/160351.
An assignment to a whole polymorphic allocatable changes its dynamic
type to the type of the right-hand side expression. But when the
assignment is under control of a WHERE statement, or a FORALL / DO
CONCURRENT with a mask expression, there is no interpretation of the
assignment, as the type of a variable must be the same for all of its
elements.
There is no restriction in the standard against this usage, and no other
Fortran compiler complains about it. But it is not possible to implement
it in general, and the behavior produced by other compilers is not
reasonable, much less worthy of emulating. It's best to simply disallow
it with an error message.
Fixes https://github.com/llvm/llvm-project/issues/133669, or more
accurately, resolves it.
Rather than admit complete confusion with a "FAIL" message when parsing
runs into the end of the source file unexpectedly, deal better with
missing or garbled END statements through the use of `consumedAllInput`
in end-of-line and end-of-statement parsers and error recovery. Adds a
new test (the original motivation) and updates the expected results in
two extant tests that were failing before.
The GNU Fortran library function FNUM(u) returns the UNIX file
descriptor that corresponds to an open Fortran unit number, if any;
otherwise -1.
This implementation is a library extension only, not an intrinsic.
The PRIF Committee is pleased to announce the publication of the
Parallel
Runtime Interface for Fortran (PRIF) Specification, Revision 0.6. The
latest
iteration of this specification represents the efforts of a
collaborative
design process involving multiple individuals across several
institutions.
The document is available here: <https://doi.org/10.25344/S4M01X>
The PRIF specification is now governed by a formal PRIF Committee.
For more details, see: <https://go.lbl.gov/prif-governance>
The Committee vote to approve the technical content in this revision
began on 2025-08-22 and concluded on 2025-09-07 with unanimous approval.
The 7-day Committee comment period for cosmetic feedback began on
2025-09-08 and concluded on 2025-09-15 with no comments.
See the Change Log in Section 1 of the document for the list of changes
relative to the prior revision.
The runtime supports a near-universal extension to namelist input that
allows reading a sequence of values into a storage sequence beginning at
an array element, e.g. &NML A(2)=1. 2. 3. / .
Disable this extension when the type of the array has a defined
formatted READ subroutine defined. That defined input procedure may
itself not be using list-directed input, and might not notice a
following slash or new input item name as such.
Fixes https://github.com/llvm/llvm-project/issues/158496.
This patch adds the flag -fexperimental-loop-fuse to the clang and flang
drivers. This is primarily useful for experiments as we envision to
enable the pass one day.
The options are based on the same principles and reason on which we have
`floop-interchange`.
---------
Co-authored-by: Madhur Amilkanthwar <madhura@nvidia.com>
Add support for DSECNDS, the double-precision variant of SECNDS.
The implementation mirrors SECNDS, reusing the shared `SecndsImpl<T>`
runtime template.
Includes:
- Registration in intrinsics table
- Lowering handler and runtime call wiring
- Hook into shared SecndsImpl in extensions.cpp
- Documentation in Intrinsics.md
- Regression test dsecnds.f90
CC @eugeneepshteyn @klausler
---------
Co-authored-by: Eugene Epshteyn <eepshteyn@nvidia.com>
This patch removes REQUIRES: shell lines and updates the tests to not
need a shell, or adds REQUIRES lines for Linux where relevant. A lot of
these seem to have gotten introduced in
58c3f20bbf, but many are no longer
relevant as these tests no longer use shell scripts.
There was one test (missing_newline.f90) that needed to be modified to
work. Lit doesn't recognize -ne correctly for echo and the options need
to be split into separate flags.
Reviewers: clementval, Meinersbur, kiranchandramohan, klausler
Reviewed By: clementval
Pull Request: https://github.com/llvm/llvm-project/pull/156115
List-directed input statements maintain two flags ("eatComma_" and
"hitSlash_") in their state that allow GetNextDataEdit() to detect and
handle field separators (usually ',') and slashes in the input stream.
For list-directed input in a defined input subroutine, it's necessary to
copy those flags from the parent list-directed input statement (if any)
and update them afterwards.
Fixes https://github.com/llvm/llvm-project/issues/154791.
This patch registers and lowers the GNU extension intrinsic `SECNDS` in
Flang.
- Registration and lowering are wired through the intrinsic
infrastructure.
- genSecnds() currently emits a TODO fatal error, marking it as
unimplemented.
- Includes an XFAIL test to exercise the lowering path and reflect
current status.
Fixes https://github.com/llvm/llvm-project/issues/58728
---
CC @eugeneepshteyn @klausler
---------
Co-authored-by: Eugene Epshteyn <eepshteyn@nvidia.com>
The script copies `ReleaseNotesTemplate.txt` to corresponding
`ReleaseNotes.rst`/`.md` to clear release notes.
The suffix of `ReleaseNotesTemplate.txt` must be `.txt`. If it is
`.rst`/`.md`, it will be treated as a documentation source file when
building documentation.
This compiler stops an ALLOCATE/DEALLOCATE statement with multiple
variables after encountering a recoverable error to avoid the risk of
ambiguity in the case of multiple errors. Document.
For more accurate compatibility with other compilers' extensions, accept
a bare exponent letter as valid real input to a formatted READ statement
only in a fixed-width input field. So it works with (G1.0) editing, but
not (G)/(D)/(E)/(F) or list-directed input.
Fixes https://github.com/llvm/llvm-project/issues/151465.