From: roucaries.bastien@gmail.com
To: bug-gnulib@gnu.org
Cc: "Bastien Roucariès" <rouca@debian.org>
Subject: [PATCH 1/2] Support clang for explicit_bzero
Date: Sat, 23 Jan 2021 11:22:10 +0000 [thread overview]
Message-ID: <20210123112211.198683-2-rouca@debian.org> (raw)
In-Reply-To: <20210123112211.198683-1-rouca@debian.org>
From: Bastien Roucariès <rouca@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 <rouca@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
next prev parent reply other threads:[~2021-01-23 11:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 11:22 [V5] explicit_bzero roucaries.bastien
2021-01-23 11:22 ` roucaries.bastien [this message]
2021-01-23 13:25 ` [PATCH 1/2] Support clang for explicit_bzero Bruno Haible
2021-01-23 11:22 ` [PATCH 2/2] Implement fallback for explicit_bzero using jump to volatile pointer roucaries.bastien
2021-01-23 13:33 ` Bruno Haible
-- strict thread matches above, loose matches on Subject: below --
2021-01-23 10:49 [V4][0/2] explicit_bzero roucaries.bastien
2021-01-23 10:49 ` [PATCH 1/2] Support clang for explicit_bzero roucaries.bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210123112211.198683-2-rouca@debian.org \
--to=roucaries.bastien@gmail.com \
--cc=bug-gnulib@gnu.org \
--cc=rouca@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).