From: Pádraig Brady Date: Wed, 17 Sep 2025 15:51:52 +0000 (+0100) Subject: tests: support -ftrivial-auto-var-init X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df414ade248344137825372651f2e24d82ce429c;p=thirdparty%2Fgnulib.git tests: support -ftrivial-auto-var-init 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. --- diff --git a/ChangeLog b/ChangeLog index 908c46cbd1..a934b4507a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-09-17 Pádraig Brady + + 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 stringeq: port to platforms declaring memeq, streq diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c index 28da6983b8..2c02e6ae12 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__ >= 14 + /* 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..ec165df9ac 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__ >= 14 + /* Support -ftrivial-auto-var-init */ + __attribute__ ((uninitialized)) +# endif char stackbuf[SECRET_SIZE]; if (pass == 1) {