summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2023-04-11 21:23:01 +0000
committerCheng Shao <terrorjack@type.dance>2023-04-21 19:43:58 +0000
commit4ee7ae9b5a81466042dee7857b41438879de885e (patch)
tree791e9863205e4b725d504a19e522d020858092e4
parent113e21d763678ea7e7666b708e6c2dba7e52382f (diff)
downloadhaskell-wip/T23247.tar.gz
testsuite/T20137: Avoid impl.-defined behaviorwip/T23247
Previously we would cast pointers to uint64_t. However, implementations are allowed to either zero- or sign-extend such casts. Instead cast to uintptr_t to avoid this. Fixes #23247.
-rw-r--r--testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-3210
-rw-r--r--testsuite/tests/codeGen/should_run/T20137/T20137C.c18
2 files changed, 14 insertions, 14 deletions
diff --git a/testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-32 b/testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-32
index 85408b75a5..30e04a5cae 100644
--- a/testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-32
+++ b/testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-32
@@ -5,9 +5,9 @@
5
6
77777777
-ffffffff88888888
-ffffffff99999999
-ffffffffaaaaaaaa
-ffffffffbbbbbbbb
+88888888
+99999999
+aaaaaaaa
+bbbbbbbb
cccccccc
-ffffffffdddddddd
+dddddddd
diff --git a/testsuite/tests/codeGen/should_run/T20137/T20137C.c b/testsuite/tests/codeGen/should_run/T20137/T20137C.c
index f68d88a054..dda9008300 100644
--- a/testsuite/tests/codeGen/should_run/T20137/T20137C.c
+++ b/testsuite/tests/codeGen/should_run/T20137/T20137C.c
@@ -16,19 +16,19 @@ runInteractiveProcess (char *const * args,
{
// N.B. We don't use %p here since the rendering of this varies across
// libc implementations
- printf("%" PRIx64 "\n", (uint64_t) args);
- printf("%" PRIx64 "\n", (uint64_t) workingDirectory);
- printf("%" PRIx64 "\n", (uint64_t) environment);
+ printf("%" PRIxPTR "\n", (uintptr_t) args);
+ printf("%" PRIxPTR "\n", (uintptr_t) workingDirectory);
+ printf("%" PRIxPTR "\n", (uintptr_t) environment);
printf("%x\n", fdStdIn);
printf("%x\n", fdStdOut);
printf("%x\n", fdStdErr);
- printf("%" PRIx64 "\n", (uint64_t) pfdStdInput);
- printf("%" PRIx64 "\n", (uint64_t) pfdStdOutput);
- printf("%" PRIx64 "\n", (uint64_t) pfdStdError);
- printf("%" PRIx64 "\n", (uint64_t) childGroup);
- printf("%" PRIx64 "\n", (uint64_t) childUser);
+ printf("%" PRIxPTR "\n", (uintptr_t) pfdStdInput);
+ printf("%" PRIxPTR "\n", (uintptr_t) pfdStdOutput);
+ printf("%" PRIxPTR "\n", (uintptr_t) pfdStdError);
+ printf("%" PRIxPTR "\n", (uintptr_t) childGroup);
+ printf("%" PRIxPTR "\n", (uintptr_t) childUser);
printf("%x\n", flags);
- printf("%" PRIx64 "\n", (uint64_t) failed_doing);
+ printf("%" PRIxPTR "\n", (uintptr_t) failed_doing);
return 0;
}