Skip to content

[flang][acc][NFC] Add deviation to the spec that declaring the same variable is permitted #148288

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

Merged
merged 2 commits into from
Jul 14, 2025

Conversation

SusanTan
Copy link
Contributor

OpenACC spec says A var may appear at most once in all the clauses of declare directives for a function, subroutine, program, or module. but our implementation allows it with a warning generated. Add this to the diviation list for record.

@llvmbot llvmbot added flang Flang issues not falling into any other category openacc labels Jul 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 11, 2025

@llvm/pr-subscribers-openacc

Author: Susan Tan (ス-ザン タン) (SusanTan)

Changes

OpenACC spec says A var may appear at most once in all the clauses of declare directives for a function, subroutine, program, or module. but our implementation allows it with a warning generated. Add this to the diviation list for record.


Full diff: https://github.com/llvm/llvm-project/pull/148288.diff

1 Files Affected:

  • (modified) flang/docs/OpenACC.md (+3)
diff --git a/flang/docs/OpenACC.md b/flang/docs/OpenACC.md
index 87f30ccd953b6..cbb2a91f0963b 100644
--- a/flang/docs/OpenACC.md
+++ b/flang/docs/OpenACC.md
@@ -27,6 +27,9 @@ local:
 * `!$acc cache` directive accepts scalar variable.
 * The `!$acc declare` directive accepts assumed size array arguments for 
   `deviceptr` and `present` clauses.
+* The OpenACC specification disallows a variable appearing multiple times in
+  clauses of `!$acc declare` directives for a function, subroutine, program,
+  or module, but we allow it with a warning.
 
 ## Remarks about incompatibilities with other implementations
 * Array element references in the data clauses are equivalent to array sections

@clementval clementval changed the title [flang] Add deviation to the spec that declaring the same variable is permitted [flang][openacc] Add deviation to the spec that declaring the same variable is permitted Jul 11, 2025
Copy link
Contributor

@clementval clementval left a comment

Choose a reason for hiding this comment

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

LGTM

@clementval
Copy link
Contributor

You can add [NFC] since it's only doc

@SusanTan SusanTan changed the title [flang][openacc] Add deviation to the spec that declaring the same variable is permitted [flang][openacc][NFC] Add deviation to the spec that declaring the same variable is permitted Jul 11, 2025
@SusanTan SusanTan changed the title [flang][openacc][NFC] Add deviation to the spec that declaring the same variable is permitted [flang][acc][NFC] Add deviation to the spec that declaring the same variable is permitted Jul 11, 2025
@@ -27,6 +27,9 @@ local:
* `!$acc cache` directive accepts scalar variable.
* The `!$acc declare` directive accepts assumed size array arguments for
`deviceptr` and `present` clauses.
* The OpenACC specification disallows a variable appearing multiple times in
clauses of `!$acc declare` directives for a function, subroutine, program,
or module, but we allow it with a warning.
Copy link
Contributor

Choose a reason for hiding this comment

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

can we change
"but we allow it with a warning" to "but it is allowed with a warning when same clause is used"

@SusanTan SusanTan requested a review from razvanlupusoru July 14, 2025 20:53
Copy link
Contributor

@razvanlupusoru razvanlupusoru left a comment

Choose a reason for hiding this comment

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

Thank you!

@SusanTan SusanTan merged commit ada514b into llvm:main Jul 14, 2025
9 of 10 checks passed
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 openacc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants