Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-10-30[flang][NFC] Change wording of an I/O runtime error messagePeter Klausler
Make a requested change to the wording of a fatal I/O error message. Differential Revision: https://reviews.llvm.org/D136984
2022-10-13[Flang] Add -fconvert option to swap endianness for unformatted files.Jonathon Penix
To accomplish this, this patch creates an optional list of environment variable default values to be set by the runtime to allow directly using the existing runtime implementation of FORT_CONVERT for I/O conversions.
2022-10-11[flang] Fix buildbot failure after D135610.Slava Zakharin
Differential Revision: https://reviews.llvm.org/D135684
2022-10-11[flang] Add cpowi function to runtime and use instead of pgmathDavid Truby
This patch adds a cpowi function to the flang runtime, and switches to using that function instead of pgmath for complex number to integer power operations. Differential Revision: https://reviews.llvm.org/D134889
2022-10-11[flang] Support GNU extensions IARGC and GETARG in runtimePeixin-Qiao
The GNU extension intrinsic IARGC is equivalent to COMMAND_ARGUMENT_COUNT, and the GETARG is similar to GET_COMMAND_ARGUMENT, but with less arguments. Reuse the runtime of COMMAND_ARGUMENT_COUNT and GET_COMMAND_ARGUMENT for IARGC and GETARG. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D133558
2022-10-11[flang] Add type-specific runtime entries for Minloc/Maxloc.Slava Zakharin
We used to have a big switch statement over the type categories and kinds inside Minloc/Maxloc. After D133051 the switch grew bigger, and this changed inlining decisions made by GCC (the build compiler). Some of the simple methods stopped being inlined, and this caused slight performance regression in Polyhedron/gas_dyn2. This change adds separate entries for real/integer data types to let them be optimized separately. Differential Revision: https://reviews.llvm.org/D135610
2022-10-07fixPeter Klausler
2022-10-07[flang][runtime] Handle array components in NAMELIST inputPeter Klausler
A namelist input item that is a derived type component reference needs additional processing when the base item or the component is an array. When both have rank > 0, the component reference must of course be subscripted. (Fixes https://gitlab-master.nvidia.com/fortran/f18-stage/-/issues/999, NAG test t/tz2.)
2022-10-07[flang][runtime] Handle array components in NAMELIST inputPeter Klausler
A namelist input item that is a derived type component reference needs additional processing when the base item or the component is an array. When both have rank > 0, the component reference must of course be subscripted. Differential Revision: https://reviews.llvm.org/D135218
2022-10-06[flang][runtime] When NAMELIST input hits EOF, signal END, not an errorPeter Klausler
NAMELIST input processing in the runtime support library treats an end-of-file found while searching for the initial '&' character as an error condition, but it really should be distinguishable. Call SignalEnd() rather than SignalError(). Differential Revision: https://reviews.llvm.org/D135212
2022-09-28[flang][runtime] Fixed identity value for REAL(16) == __float128.Slava Zakharin
std::numeric_limits<__float128>::max/lowest return 0.0, so recreate value of FLT128_MAX ourselves to avoid using quadmath.h's FLT128_MAX that is currently causes warnings with GCC -Wpedantic. Differential Revision: https://reviews.llvm.org/D134496
2022-09-22[flang][runtime] Fixes for element size calculation.Slava Zakharin
BytesFor() used to return KIND for the size, which is not always correct, so I changed it to return the size of the actual CppType corresponding to the given category and kind. MinElemLen() used to calculate size incorrectly (e.g. CFI_type_extended_double was sized 10, whereas it may occupy more bytes on a target), so I changed it to call BytesFor(). Additional changes were needed to resolve new failures for transformational intrinsics. These intrinsics used to work for not fully supported data types (e.g. REAL(3)), but now stopped working because CppType cannot be computed for those categories/kinds. The solution is to use known element size from the source argument(s) for establishing the destination descriptor - the element size is all that is needed for transformational intrinsics to keep working. Note that this does not help cases, where runtime still has to compute the element size, e.g. when it creates descriptors for components of derived types. If the component has unsupported data type, BytesFor() will still fail. So these cases require adding support for the missing types. New regression unit test in Runtime/Transformational.cpp demonstrates the case that will start working properly with this commit.
2022-09-20[flang] Give explicit convert= specifiers precedence over FORT_CONVERTJonathon Penix
Currently, the FORT_CONVERT environment variable has the highest priority when setting the endianness conversion for unformatted files. In discussing the appropriate priority for the fconvert option, convert specifiers were decided to take highest priority. This patch also initializes the open statement convert state to unknown to disambiguate cases where the convert specifier was not provided from cases where convert=native was set. This makes it possible to defer to the environment setting where appropriate. Differential Revision: https://reviews.llvm.org/D133237
2022-09-13[flang][runtime] ensure character compares to blank are unsignedJean Perier
CompareToBlankPadding was doing signed compare on architecture where `char` is signed. This caused `'abc'//char(128) > 'abc'` to evaluate to false at runtime instead of true. Differential Revision: https://reviews.llvm.org/D133693
2022-09-01[flang][runtime] Enable real/complex kind 10 and 16 variants of dot_product.Slava Zakharin
HasCppTypeFor<> used to evaluate to false always, so kind 10 and 16 variants of dot_product were not instantiated even though the host supported 80- and 128-bit real and complex data types. In addition, HAS_FLOAT128 was not enabling complex kind=16 variant of dot_product. This is fixed now. Note that the change for HasCppTypeFor<> may also affect other functions such as matmul, i.e. kind 10 and 16 variants of them may become available now (depending on the build host). Differential Revision: https://reviews.llvm.org/D133051
2022-08-28[flang] Use std::clamp (NFC)Kazu Hirata
The use of std::clamp here is safe because the definition of largestLDKind gurantees that 8 <= largestLDKind.
2022-08-26[flang][runtime] Corrections for byte-swapped I/OPeter Klausler
Unformatted I/O with byte swapping was reversing bytes in badly-sized frames for character, complex, and some default derived type transfers. Differential Revision: https://reviews.llvm.org/D132751
2022-08-26[flang][runtime] Fix MINVAL([CHARACTER(2)::])Peter Klausler
The result of MINVAL over an empty default character array should (per the standard) have a 127 in every character position, not just the first. Differential Revision: https://reviews.llvm.org/D132677
2022-08-25[flang] [runtime] Fix build warnings if built with mingwMartin Storsjö
Check whether `F_OK` et al are defined before redefining them; mingw headers do define them, so check before providing the windows fallback defines. Also check `_WIN32` instead of `WIN32`; this is how it's consistently done in the rest of llvm. (The former is a compiler builtin define, while the latter isn't, but it's commonly set by e.g. build systems.) Differential Revision: https://reviews.llvm.org/D132481
2022-08-24[flang] Noncontiguous formatsV Donaldson
Add the remaining pieces to support IO for noncontigous formats. This is done by passing an array descriptor to IO calls. Scalar formats continue to pass string and length arguments. IO calls with formats are modified to place the new format descriptor argument directly after the original string and length arguments.
2022-08-23[flang] Allow configuring building the flang runtime standaloneMartin Storsjö
This allows building the flang runtime and libFortranDecimal standalone, without setting up the full llvm build, by pointing cmake to these directories. This is the other one out of two essential steps for building the flang runtimes for a foreign target, i.e. setting up cross compiling with flang. Differential Revision: https://reviews.llvm.org/D130352
2022-08-19[flang][runtime] Catch input error case of missing integer valuePeter Klausler
Formatted input allows for an empty numeric input field, which signifies a zero value, but list-directed and NAMELIST input does not -- apart from the special case of a NAMELIST array. Differential Revision: https://reviews.llvm.org/D132178
2022-08-19[flang][runtime] Handle endian-swapped record headers & footers on inputPeter Klausler
The runtime I/O library correctly handles endianness conversions on payload data I/O and on the output of sequential record headers and footers, but does not swap endianness when required when reading sequential record headers and footers back in for READ and BACKSPACE statements. Mea culpa. Fix. Fixes https://github.com/llvm/llvm-project/issues/57126 Differential Revision: https://reviews.llvm.org/D132168
2022-08-19[flang] Support for character array formatsPeter Klausler
A character array can be used as a format in an I/O data transfer statement, with the interpretation that its elements are concatenated in element order to constitute the format. Support in the runtime with an extra optional descriptor argument to six I/O API calls; support in semantics by removing an earlier check for a simply contiguous array presented as a format. Some work needs to be done in lowering to pass a character array descriptor to the I/O runtime API when present Differential Revision: https://reviews.llvm.org/D132167
2022-08-19[flang][runtime] Don't raise internal error in user error recovery situationPeter Klausler
In the case of a data transfer I/O statement with an illegal unit number and error recovery, ensure that data transfer API calls don't raise internal errors due to the I/O statement representation unexpectedly being something other than a data transfer statement. Differential Revision: https://reviews.llvm.org/D132160
2022-08-19[flang][runtime] Fix error messagePeter Klausler
A literal % character in an error message needs to be doubled so that it appears in the output of snprintf(). Differential Revision: https://reviews.llvm.org/D132158
2022-08-19[flang][runtime] Catch input error on missing NAMELIST scalarPeter Klausler
While a NAMELIST input group item for an array can have fewer values than expected, or none, an input group item for a scalar must have a value. Differential Revision: https://reviews.llvm.org/D132157
2022-08-19[flang][runtime] Fix return value for MINVAL/MAXVAL for CHARACTER(kind > 1)Peter Klausler
CharacterExtremumAccumulator::GetResult() needs to use byte counts, not wide character counts, when calling memcpy() & memset(). Differential Revision: https://reviews.llvm.org/D132156
2022-08-19[flang][runtime] Improve Fortran I/O behavior when main program is C/C++Peter Klausler
Ensure that I/O buffers are flushed at the end of the program, and properly detect ttys for predefined units so that Fortran output is interspersed with output from non-Fortran code. Fixes https://github.com/llvm/llvm-project/issues/56944 Differential Revision: https://reviews.llvm.org/D132152 Update: fix typo in comment
2022-08-18[flang][runtime] Improve error message for incompatible MATMUL argumentsPeter Klausler
Print the full shapes of both argument when the dimensions that must match do not do so. Differential Revision: https://reviews.llvm.org/D132153
2022-08-15[flang] Install runtime libs with the toolchainDiana Picus
Make sure that FortranDecimal, FortranRuntime and Fortran_main are installed/packaged even when LLVM_INSTALL_TOOLCHAIN_ONLY is enabled. They are used by flang to link executables, so they should be provided even with minimal installs. Differential Revision: https://reviews.llvm.org/D131670
2022-08-09[flang] Fix build warning from newer compilersPeter Klausler
Remove a lambda capture of "[this]" in two cases where it is no longer required. Will be pushed without waiting for review if CI is successful in order to resolve a sad build bot. Differential Revision: https://reviews.llvm.org/D131506
2022-08-09[flang] Intrinsic RANDOM_SEED calls with dynamically absent/present argumentsV Donaldson
2022-08-09[flang][runtime] Support internal I/O to CHARACTER(KIND/=1)Peter Klausler
Allow internal I/O to support non-default kinds of CHARACTER. The I/O runtime design anticipated this standard feature, but this patch is somewhat larger than I thought it would be because many code sites had to have assumptions about units (characters vs. bytes) brought into harmony, and some encoding utilities had to be pulled out of IoStatementState and templatized into their own new header file so that they are available to formatted output code without having to "thread" an IoStatementState reference through many call chains. Differential Revision: https://reviews.llvm.org/D131107
2022-08-07[flang][runtime] Catch & report attempts at recursive I/OPeter Klausler
When an I/O statement contains a function call that attempts to perform I/O on the same unit, detect the recursive I/O and terminate with a useful message rather than deadlocking in the threading library. Differential Revision: https://reviews.llvm.org/D131097
2022-08-02[flang] Support extention intrinsic ABORTPeixin Qiao
The semantic checks and runtime have been supported. This supports the lowering of intrinsic ABORT. `gfortran` prints a backtrace before abort, unless `-fno-backtrace` is given. This is good to use. The intrinsic BACKTRACE is not supported yet, so add TODO in the runtime. This extention is needed in SPEC2017 521.wrf_r in https://github.com/llvm/llvm-project/issues/55955. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D130439
2022-07-27[flang] Single entry point for GET_COMMAND_ARGUMENTDiana Picus
This patch refactors the runtime support for GET_COMMAND_ARGUMENT to have a single entry point instead of 2. It also updates lowering accordingly. This makes it easier to handle dynamically optional arguments. See also https://reviews.llvm.org/D118777 Differential Revision: https://reviews.llvm.org/D130475
2022-07-25[flang][runtime] Reset unit frame buffer when re-openingPeter Klausler
An OPEN statement that implies closing a connection must invalidate the unit's frame buffer so as to prevent stale data from the old connection from being read into the newly-connected unit. Differential Revision: https://reviews.llvm.org/D130430
2022-07-25[flang] Support intrinsic `selected_int_kind` for variablesPeixin Qiao
As Fortran 2018 16.9.169, the argument of selected_int_kind is integer scalar, and result is default integer scalar. The constant expression in this intrinsic has been supported by folding the constant expression. This supports lowering and runtime for variables in this intrinsic. Reviewed By: Jean Perier Differential Revision: https://reviews.llvm.org/D129959
2022-07-25[flang] Support lowering intrinsic `selected_real_kind` for variablesPeixin Qiao
As Fortran 2018 16.9.170, the argument of `selected_real_kind` is integer scalar, and result is default integer scalar. The constant expression in this intrinsic has been supported by folding the constant expression. This supports lowering this intrinsic for variables using runtime. Reviewed By: Jean Perier Differential Revision: https://reviews.llvm.org/D130183
2022-07-23[flang] Support aint/anint for 80/128 bit in loweringPeixin Qiao
For aint/anint, LLVM conversion operations llvm.trunc and llvm.round can support the edge case of aint(-0.) and anint(-0.). The output is -0. and it is the same of `gfortran` and `classic flang`, while the output of `ifort` is 0.. The `real(10)/real(16)` is not supported before. Support it and remove the runtime functions for aint/anint. For nint, `gfortran`, `ifort`, and LLVM Flang using llvm.lround have different results when the magnitude of argument is more than the max of result value range. So delay its support in lowering after more investigations. Reviewed By: vzakhari Differential Revision: https://reviews.llvm.org/D130024
2022-07-14[flang] Error detection/avoidance for TRANSFER with empty MOLD= typePeter Klausler
When MOLD= is an array and there is no SIZE= in a call to TRANSFER(), the size of an element of the MOLD= is used as the denominator in a division to establish the extent of the vector result. When the total storage size of the SOURCE= is known to be zero, the result is empty and no division is needed. To avoid a division by zero at runtime, we need to check for a zero-sized MOLD= element type when the storage size of SOURCE= is nonzero and there is no SIZE=. Further, in the compilation-time rewriting of calls to SHAPE(TRANSFER(...)) and SIZE(TRANSFER(...)) for constant folding and simplification purposes, we can't replace the call with an arithmetic element count expression when the storage size of SOURCE= is not known to be zero and the element size of MOLD= is not known to be nonzero at compilation time. These changes mostly affect tests using a MOLD= argument that is an assumed-length character. Differential Revision: https://reviews.llvm.org/D129680
2022-07-14[flang][runtime] Complete list-directed character input with DECIMAL='COMMA'Peter Klausler
Most of the infrastructure for DECIMAL='COMMA' mode was in place in the I/O runtime support library, but I dropped the ball for list-directed character input, which has its own detection of input separators. Finish the job. Differential Revision: https://reviews.llvm.org/D129679
2022-07-14[flang][runtime] Keep frame buffer in sync with file when truncatingPeter Klausler
When the I/O runtime is truncating an external file due to an implied ENDFILE or explicit ENDFILE, ensure that the unit's frame buffer for the file discards any data that have become obsolete. This bug caused trouble with ACCESS='STREAM' I/O using POS= on a WRITE, but it may have not been limited to that scenario. Differential Revision: https://reviews.llvm.org/D129673
2022-07-14[flang][runtime] Refine list-directed REAL(2) outputPeter Klausler
The rule used by list-directed REAL output editing to select between Ew.d and Fw.d output editing breaks down for 16-bit floating-point data, since the number of significant decimal digits is so low that Ew,d output editing is nearly always selected. Cap the test so that five-digit values will be output with Fw.d editing. Differential Revision: https://reviews.llvm.org/D129672
2022-07-08[flang] Fix typo in runtime messagePeter Steinfeld
The title says it. Differential Revision: https://reviews.llvm.org/D129329
2022-07-07[flang] SET_EXPONENT(-0.0) should return -0.0Peter Steinfeld
Section 16.9.171 says: If X has the value zero, the result has the same value as X So if X is -0.0, SET_EXPONENT should return -0.0. Differential Revision: https://reviews.llvm.org/D129309
2022-07-07[flang][runtime] Trim FORMATs echoed to error messagesPeter Klausler
Since dynamic FORMAT strings usually come from blank-padded fixed-length CHARACTER variables, trim leading and trailing blanks from them when they are echoed to error messages for better readability. Differential Revision: https://reviews.llvm.org/D129024
2022-07-07[flang][runtime] Fix directed UP/DOWN rounding edge case for Fw.d outputPeter Klausler
When Fw.d output editing takes place with directed rounding, make sure that nonzero values that would normally be converted to zero round up (or down, depending on the sign) to a scaled 1. Differential Revision: https://reviews.llvm.org/D129021
2022-07-07[flang] Cope with overflow in real MOD/MODULOPeter Klausler
In folding and in the runtime library for real MOD/MODULO(A,P), detect overflow from the division A/P and return a properly signed zero result. (When A/P overflows and both A and P are finite numbers with nonzero P, the quotient would be a large integer when rounded to the precision of the floating-point representation.) Differential Revision: https://reviews.llvm.org/D129020