> diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
> index 87fadba81a..71a1cca3b0 100644
> --- a/lib/explicit_bzero.c
> +++ b/lib/explicit_bzero.c
> @@ -56,9 +56,19 @@ explicit_bzero (void *s, size_t len)
> (void) memset_s (s, len, '\0', len);
> #else
> memset (s, '\0', len);
> -# if defined __GNUC__ && !defined __clang__
> - /* Compiler barrier. */
> +# if defined __GNUC__
> +/* Compiler barrier. */
> +# if !defined __clang__
> asm volatile ("" ::: "memory");
> +# else
> + /* See https://bugs.llvm.org/show_bug.cgi?id=15495#c11
> + with asm("" ::: "memory") LLVM analyzes uses of 's'
> + and finds that the whole thing is dead and eliminates it.
> +
> + Using g workarround this problem
> + */
> + __asm__ volatile("" : : "g"(s) : "memory");
> +# endif
> # endif
> #endif
> }
Thanks. I applied this with two changes:
- Make it work also with clang on Windows. Recall that clang on Windows
does not define __GNUC__ [1].
- Use a gnulib-style ChangeLog entry.
Bruno
[1] https://lists.gnu.org/archive/html/bug-gnulib/2020-08/msg00038.html