Skip to content

Commit 7493ea2

Browse files
earnolEänolituri LómitaurëAaronBallmanilovepi
authored
[test]Fix test error due to CRT dependency (#104462)
Remove CRT dependency in headers stdint.h, stdio.h inside test clang/test/CodeGen/bit-int-ubsan.c --------- Co-authored-by: Eänolituri Lómitaurë <[email protected]> Co-authored-by: Aaron Ballman <[email protected]> Co-authored-by: Paul Kirth <[email protected]>
1 parent 75ea8e8 commit 7493ea2

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

clang/test/CodeGen/bit-int-ubsan.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
// REQUIRES: x86-registered-target
2-
// RUN: %clang -Wno-constant-conversion -Wno-array-bounds -Wno-division-by-zero -Wno-shift-negative-value -Wno-shift-count-negative -Wno-int-to-pointer-cast -fsanitize=array-bounds,enum,float-cast-overflow,integer-divide-by-zero,implicit-unsigned-integer-truncation,implicit-signed-integer-truncation,implicit-integer-sign-change,unsigned-integer-overflow,signed-integer-overflow,shift-base,shift-exponent -O0 -S -emit-llvm -o - %s | FileCheck %s
2+
// RUN: %clang_cc1 -Wno-constant-conversion -Wno-array-bounds -Wno-division-by-zero -Wno-shift-negative-value -Wno-shift-count-negative -Wno-int-to-pointer-cast -fsanitize=array-bounds,enum,float-cast-overflow,integer-divide-by-zero,implicit-unsigned-integer-truncation,implicit-signed-integer-truncation,implicit-integer-sign-change,unsigned-integer-overflow,signed-integer-overflow,shift-base,shift-exponent -O0 -emit-llvm -o - %s | FileCheck %s
33

44
// The runtime test checking the _BitInt ubsan feature is located in compiler-rt/test/ubsan/TestCases/Integer/bit-int.c
55

6-
#include <stdint.h>
7-
#include <stdio.h>
8-
6+
typedef unsigned int uint32_t;
97
uint32_t float_divide_by_zero() {
108
float f = 1.0f / 0.0f;
119
// 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)
7876
return x >> c;
7977
// CHECK: constant { i16, i16, [20 x i8] } { i16 2, i16 {{([[:xdigit:]]{2})}}, [20 x i8] c"'_BitInt(68)'\00D\00\00\00\00\00" }
8078
}
81-
82-
int main(int argc, char **argv) {
83-
// clang-format off
84-
uint64_t result =
85-
1ULL +
86-
implicit_unsigned_integer_truncation() +
87-
(uint32_t)array_bounds() +
88-
float_cast_overflow() +
89-
(uint64_t)implicit_signed_integer_truncation() +
90-
negative_shift1(5) +
91-
negative_shift2(5) +
92-
negative_shift3(5) +
93-
negative_shift5(5);
94-
// clang-format on
95-
printf("%u\n", (uint32_t)(result & 0xFFFFFFFF));
96-
}

0 commit comments

Comments
 (0)