[flang-commits] [flang] [flang][doc] refine zero initialization extension documentation (PR #121956)
via flang-commits
flang-commits at lists.llvm.org
Tue Jan 7 08:28:22 PST 2025
https://github.com/jeanPerier updated https://github.com/llvm/llvm-project/pull/121956
>From 6c33a53f49da342ace193495b749a88b95d6a345 Mon Sep 17 00:00:00 2001
From: Jean Perier <jperier at nvidia.com>
Date: Tue, 7 Jan 2025 07:34:05 -0800
Subject: [PATCH 1/2] [flang][doc] refine zero initialization extension
---
flang/docs/Extensions.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/flang/docs/Extensions.md b/flang/docs/Extensions.md
index 2d1c967a6068de..dc0dc05ba99953 100644
--- a/flang/docs/Extensions.md
+++ b/flang/docs/Extensions.md
@@ -160,7 +160,10 @@ end
* `<>` as synonym for `.NE.` and `/=`
* `$` and `@` as legal characters in names
* Initialization in type declaration statements using `/values/`
-* Saved variables without explicit or default initializers are zero initialized.
+* Saved variables without explicit or default initializers are zero initialized,
+ except for implicitly saved scalar variables from the main program that are
+ kept on the stack by flang and are not zero initialized. It is not advised to
+ rely on this extension in new code.
* In a saved entity of a type with a default initializer, components without default
values are zero initialized.
* Kind specification with `*`, e.g. `REAL*4`
>From 1dc3e11d532527fcd38447ffd0f3f1b9212cb845 Mon Sep 17 00:00:00 2001
From: Jean Perier <jperier at nvidia.com>
Date: Tue, 7 Jan 2025 08:27:47 -0800
Subject: [PATCH 2/2] update text
---
flang/docs/Extensions.md | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/flang/docs/Extensions.md b/flang/docs/Extensions.md
index dc0dc05ba99953..907f01204a3871 100644
--- a/flang/docs/Extensions.md
+++ b/flang/docs/Extensions.md
@@ -161,8 +161,9 @@ end
* `$` and `@` as legal characters in names
* Initialization in type declaration statements using `/values/`
* Saved variables without explicit or default initializers are zero initialized,
- except for implicitly saved scalar variables from the main program that are
- kept on the stack by flang and are not zero initialized. It is not advised to
+ except for scalar variables from the main program that are not explicitly
+ initialized or marked with an explicit SAVE attribute (these variables may be
+ placed on the stack by flang and not zero initialized). It is not advised to
rely on this extension in new code.
* In a saved entity of a type with a default initializer, components without default
values are zero initialized.
More information about the flang-commits
mailing list