[flang-commits] [flang] [flang] Add deviation to the spec that declaring the same variable is permitted (PR #148288)

Susan Tan ス-ザン タン via flang-commits flang-commits at lists.llvm.org
Fri Jul 11 13:18:20 PDT 2025


https://github.com/SusanTan created https://github.com/llvm/llvm-project/pull/148288

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.



>From 2f8a7fcef4d9911be898ec4afb6b99a80c1941ae Mon Sep 17 00:00:00 2001
From: Susan Tan <zujunt at nvidia.com>
Date: Fri, 11 Jul 2025 13:15:41 -0700
Subject: [PATCH] add deviation of declare same variable

---
 flang/docs/OpenACC.md | 3 +++
 1 file changed, 3 insertions(+)

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



More information about the flang-commits mailing list