Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang][NFC] document BOZ error in DIM, MOD, MODULO, and SIGN #87779

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

jeanPerier
Copy link
Contributor

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

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 |
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Apr 5, 2024
Copy link
Contributor

@psteinfeld psteinfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@jeanPerier jeanPerier merged commit 3c210d1 into llvm:main Apr 8, 2024
7 checks passed
@jeanPerier jeanPerier deleted the jpr_update_doc branch April 8, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants