]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
tests: support -ftrivial-auto-var-init
authorPádraig Brady <P@draigBrady.com>
Wed, 17 Sep 2025 15:51:52 +0000 (16:51 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 17 Sep 2025 19:36:33 +0000 (20:36 +0100)
Tested with gcc 15 and clang 20.
Note clang didn't need the adjustment,
but it was applied for clang also, to be defensive.

* tests/test-memset_explicit.c (do_secret_stuff): Mark stack variable
as not to be initialized with either zero or pattern on each invocation.
tests/test-explicit_bzero.c (do_secret_stuff): Likewise.

ChangeLog
tests/test-explicit_bzero.c
tests/test-memset_explicit.c

index 908c46cbd1d01fc84a21d714080677a4ab18553b..a934b4507ac1d324b0622530e43eefe7be42d647 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-09-17  Pádraig Brady  <P@draigBrady.com>
+
+       tests: support -ftrivial-auto-var-init
+       * tests/test-memset_explicit.c (do_secret_stuff): Mark stack variable
+       as not to be initialized with either zero or pattern on each invocation.
+       tests/test-explicit_bzero.c (do_secret_stuff): Likewise.
+
 2025-09-17  Paul Eggert  <eggert@cs.ucla.edu>
 
        stringeq: port to platforms declaring memeq, streq
index 28da6983b82726beaa893ec66eadb59228f43f96..2c02e6ae12f957860b5e10d0f6ddb6b2a1761d07 100644 (file)
@@ -176,6 +176,10 @@ __attribute__ ((__noipa__))
 # endif
 do_secret_stuff (int volatile pass, char *volatile *volatile last_stackbuf)
 {
+# if _GL_GNUC_PREREQ (12, 0) ||  __clang_major__ >= 14
+  /* Support -ftrivial-auto-var-init  */
+  __attribute__ ((uninitialized))
+# endif
   char stackbuf[SECRET_SIZE];
   if (pass == 1)
     {
index d4c481b40956b86de7fec326749872ea702cd2b8..ec165df9ac707da32c722fbfe0e81c9872035071 100644 (file)
@@ -201,6 +201,10 @@ __attribute__ ((__noipa__))
 # endif
 do_secret_stuff (int pass, char *volatile *last_stackbuf)
 {
+# if _GL_GNUC_PREREQ (12, 0) ||  __clang_major__ >= 14
+  /* Support -ftrivial-auto-var-init  */
+  __attribute__ ((uninitialized))
+# endif
   char stackbuf[SECRET_SIZE];
   if (pass == 1)
     {