Tested with gcc 15 and clang 20. Note clang didn't need the adjustment, but it was applied also for clang 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 | 7 +++++++ tests/test-explicit_bzero.c | 4 ++++ tests/test-memset_explicit.c | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6950893292..04688caa73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-09-17 Pádraig Brady <[email protected]> + + 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 Pádraig Brady <[email protected]> doc: MODULES.html.sh: add missing cpu-supports entry diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c index 28da6983b8..5465a7249d 100644 --- a/tests/test-explicit_bzero.c +++ b/tests/test-explicit_bzero.c @@ -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__ >= 8 + /* Support -ftrivial-auto-var-init */ + __attribute__ ((uninitialized)) +# endif char stackbuf[SECRET_SIZE]; if (pass == 1) { diff --git a/tests/test-memset_explicit.c b/tests/test-memset_explicit.c index d4c481b409..1ddd49356e 100644 --- a/tests/test-memset_explicit.c +++ b/tests/test-memset_explicit.c @@ -201,6 +201,10 @@ __attribute__ ((__noipa__)) # endif do_secret_stuff (int pass, char *volatile *last_stackbuf) { +# if _GL_GNUC_PREREQ (12, 0) || __clang_major__ >= 8 + /* Support -ftrivial-auto-var-init */ + __attribute__ ((uninitialized)) +# endif char stackbuf[SECRET_SIZE]; if (pass == 1) { -- 2.50.1
