Skip to content

Commit

Permalink
[libcxxabi] [test] Use the correct printf formats for printing pointers
Browse files Browse the repository at this point in the history
Don't cast the pointers to long, as that's not large enough for
pointers on 64 bit Windows.

Differential Revision: https://reviews.llvm.org/D147640
  • Loading branch information
mstorsjo committed Apr 17, 2023
1 parent 2069bce commit c4a735d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libcxxabi/test/test_fallback_malloc.pass.cpp
Expand Up @@ -9,6 +9,7 @@
#include <cstdio>
#include <deque>
#include <cassert>
#include <inttypes.h>

#include <__threading_support>

Expand Down Expand Up @@ -192,11 +193,11 @@ int main () {
print_free_list ();

char *p = (char *) fallback_malloc ( 1024 ); // too big!
std::printf("fallback_malloc ( 1024 ) --> %lu\n", (unsigned long ) p);
std::printf("fallback_malloc ( 1024 ) --> %" PRIuPTR"\n", (uintptr_t) p);
print_free_list ();

p = (char *) fallback_malloc ( 32 );
std::printf("fallback_malloc ( 32 ) --> %lu\n", (unsigned long) (p - heap));
std::printf("fallback_malloc ( 32 ) --> %" PRIuPTR"\n", (uintptr_t) (p - heap));
if ( !is_fallback_ptr ( p ))
std::printf("### p is not a fallback pointer!!\n");

Expand Down

0 comments on commit c4a735d

Please sign in to comment.