[PATCH] D87375: [compiler-rt] Support glibc's non-standard I printf flag character

Stephan Bergmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 08:39:23 PDT 2020


sberg added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_format.inc:410
     // Flags
-    while (char_is_one_of(*p, "'-+ #0")) {
+    while (char_is_one_of(*p, "'-+ #0I")) {
       ++p;
----------------
hubert.reinterpretcast wrote:
> Note that Clang favours the MSVCRT interpretation of `printf("%I64d\n", 42LL);`.
But then again all of this code is guarded by
```
#if SANITIZER_INTERCEPT_PRINTF
```
and the only place to define `SANITIZER_INTERCEPT_PRINTF` appears to be
```
# define SANITIZER_INTERCEPT_PRINTF SI_POSIX
```
in `compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h`, so it looks like this code is only used for Posix environments, at least for now?

But maybe it would be better to only include `I` in the above string literal conditionally on `SI_POSIX` (or `SANITIZER_POSIX`, which appears to be the same thing, cf. `llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h`)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87375/new/

https://reviews.llvm.org/D87375



More information about the llvm-commits mailing list