[flang-commits] [flang] 3c210d1 - [flang][NFC] document BOZ error in DIM, MOD, MODULO, and SIGN (#87779)
via flang-commits
flang-commits at lists.llvm.org
Mon Apr 8 01:19:37 PDT 2024
Author: jeanPerier
Date: 2024-04-08T10:19:34+02:00
New Revision: 3c210d1cfdf4d8cd56de70fa40d01398e29044dc
URL: https://github.com/llvm/llvm-project/commit/3c210d1cfdf4d8cd56de70fa40d01398e29044dc
DIFF: https://github.com/llvm/llvm-project/commit/3c210d1cfdf4d8cd56de70fa40d01398e29044dc.diff
LOG: [flang][NFC] document BOZ error in DIM, MOD, MODULO, and SIGN (#87779)
It is highly ambiguous to what type BOZ should be resolved in DIM, MOD,
MODULO, and SIGN intrinsic arguments. Some other compilers accept them,
but none agree. See table below.
List them explicitly as non supported extensions (semantics already
reject them, this is an NFC).
Table listing the resolved types of the intrinsic results when there is
a BOZ argument:
| | gfortran | nvfortran | ifort | nagfor | xlf |
| ------------------- | -------- | --------- | ----- | ------ | ------ |
| DIM(INT4, BOZ) | INT16 | INT4 | INT8 | crash | INT4 |
| DIM(BOZ, REAL4) | error | INT8 | error | error | REAL4 |
| DIM(REAL4, BOZ) | error | REAL4 | error | error | REAL4 |
| DIM(BOZ, INT4) | INT16 | INT8 | INT8 | INT8 | INT4 |
| DIM(BOZ, BOZ) | INT16 | INT8 | INT8 | INT8 | REAL4 |
| MOD(INT4, BOZ) | INT16 | INT4 | INT8 | crash | INT4 |
| MOD(BOZ, REAL4) | error | INT8 | error | error | REAL4 |
| MOD(REAL4, BOZ) | error | REAL4 | error | error | REAL4 |
| MOD(BOZ, INT4) | INT16 | INT8 | INT8 | INT8 | INT4 |
| MOD(BOZ, BOZ) | INT16 | INT8 | INT8 | INT8 | INT4 |
| MODULO(INT4, BOZ) | INT16 | INT4 | INT8 | crash | INT4 |
| MODULO(BOZ, REAL4) | error | INT8 | error | error | REAL4 |
| MODULO(REAL4, BOZ) | error | REAL4 | error | error | REAL4 |
| MODULO(BOZ, INT4) | INT16 | INT8 | INT8 | INT8 | INT4 |
| MODULO(BOZ, BOZ) | INT16 | INT8 | INT8 | INT8 | INT8 |
| SIGN(INT4, BOZ) | error | INT4 | INT8 | INT4 | INT4 |
| SIGN(BOZ, REAL4) | error | INT8 | error | error | REAL4 |
| SIGN(REAL4, BOZ) | error | REAL4 | error | error | REAL4 |
| SIGN(BOZ, INT4) | error | INT8 | INT8 | INT8 | INT4 |
| SIGN(BOZ, BOZ) | INT16 | INT8 | INT8 | INT8 | REAL4 |
Added:
Modified:
flang/docs/Extensions.md
Removed:
################################################################################
diff --git a/flang/docs/Extensions.md b/flang/docs/Extensions.md
index 697bd131c04c7a..d44242de17d567 100644
--- a/flang/docs/Extensions.md
+++ b/flang/docs/Extensions.md
@@ -193,7 +193,9 @@ end
converted. BOZ literals are interpreted as default INTEGER only
when they appear as the first items of array constructors with no
explicit type. Otherwise, they generally cannot be used if the type would
- not be known (e.g., `IAND(X'1',X'2')`).
+ not be known (e.g., `IAND(X'1',X'2')`, or as arguments of `DIM`, `MOD`,
+ `MODULO`, and `SIGN`. Note that while other compilers may accept such usages,
+ the type resolution of such BOZ literals usages is highly non portable).
* BOZ literals can also be used as REAL values in some contexts where the
type is unambiguous, such as initializations of REAL parameters.
* EQUIVALENCE of numeric and character sequences (a ubiquitous extension),
More information about the flang-commits
mailing list