[clang] [compiler-rt] [test]Fix test error due to CRT dependency (PR #104462)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 15 08:52:32 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (earnol)

<details>
<summary>Changes</summary>

Remove CRT dependency in headers stdint.h, stdio.h inside test
clang/test/CodeGen/bit-int-ubsan.c

---
Full diff: https://github.com/llvm/llvm-project/pull/104462.diff


1 Files Affected:

- (modified) clang/test/CodeGen/bit-int-ubsan.c (+1-19) 


``````````diff
diff --git a/clang/test/CodeGen/bit-int-ubsan.c b/clang/test/CodeGen/bit-int-ubsan.c
index 35f96963c181d..a6328f90be95a 100644
--- a/clang/test/CodeGen/bit-int-ubsan.c
+++ b/clang/test/CodeGen/bit-int-ubsan.c
@@ -3,9 +3,7 @@
 
 // The runtime test checking the _BitInt ubsan feature is located in compiler-rt/test/ubsan/TestCases/Integer/bit-int.c
 
-#include <stdint.h>
-#include <stdio.h>
-
+typedef unsigned int uint32_t;
 uint32_t float_divide_by_zero() {
   float f = 1.0f / 0.0f;
   // CHECK: constant { i16, i16, [8 x i8] } { i16 1, i16 32, [8 x i8] c"'float'\00" }
@@ -78,19 +76,3 @@ uint32_t negative_shift5(unsigned _BitInt(37) x)
   return x >> c;
   // CHECK: constant { i16, i16, [20 x i8] } { i16 2, i16 {{([[:xdigit:]]{2})}}, [20 x i8] c"'_BitInt(68)'\00D\00\00\00\00\00" }
 }
-
-int main(int argc, char **argv) {
-  // clang-format off
-  uint64_t result =
-      1ULL +
-      implicit_unsigned_integer_truncation() +
-      (uint32_t)array_bounds() +
-      float_cast_overflow() +
-      (uint64_t)implicit_signed_integer_truncation() +
-      negative_shift1(5) +
-      negative_shift2(5) +
-      negative_shift3(5) +
-      negative_shift5(5);
-  // clang-format on
-  printf("%u\n", (uint32_t)(result & 0xFFFFFFFF));
-}

``````````

</details>


https://github.com/llvm/llvm-project/pull/104462


More information about the cfe-commits mailing list