From: Bastien Roucariès <ro...@debian.org> According to https://bugs.llvm.org/show_bug.cgi?id=15495#c11 llvm need g type constraint
Signed-off-by: Bastien Roucariès <ro...@debian.org> --- lib/explicit_bzero.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 } -- 2.29.2