Skip to content

Commit 251a2e7

Browse files
committed
[NFC][BoundsSafety] Fix UBSan test cases added for #11645
In #11645 test cases combining `-fbounds-safety` trap mode with UBSan in trapping mode. The generated IR includes a global string array that contains an absolute file path. The test case was previously manually patched so that any path would match to make the test case portable. However, the length of the constant array was not changed which still meant the test wasn't portable. This fixes that by allowing any length for the global arrays rdar://158088757
1 parent 700f71b commit 251a2e7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clang/test/BoundsSafety/CodeGen/soft-traps/call_with_code_with_ubsan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
// To workaround this these lines have been manually patched.
4444

4545
//.
46-
// UNOPT: @.src = private unnamed_addr constant [136 x i8] c"{{.+}}", align 1
46+
// UNOPT: @.src = private unnamed_addr constant [{{[0-9]+}} x i8] c"{{.+}}", align 1
4747
// UNOPT: @[[GLOB0:[0-9]+]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
4848
//.
49-
// UNOPT-TF: @.src = private unnamed_addr constant [136 x i8] c"{{.+}}", align 1
49+
// UNOPT-TF: @.src = private unnamed_addr constant [{{[0-9]+}} x i8] c"{{.+}}", align 1
5050
// UNOPT-TF: @[[GLOB0:[0-9]+]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
5151
//.
52-
// UNOPT-TFR: @.src = private unnamed_addr constant [136 x i8] c"{{.+}}", align 1
52+
// UNOPT-TFR: @.src = private unnamed_addr constant [{{[0-9]+}} x i8] c"{{.+}}", align 1
5353
// UNOPT-TFR: @[[GLOB0:[0-9]+]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
5454
//.
5555
// UNOPT-LABEL: define dso_local i32 @read(

clang/test/BoundsSafety/CodeGen/soft-traps/call_with_str_with_ubsan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@
4343
// To workaround this these lines have been manually patched.
4444

4545
//.
46-
// UNOPT: @.src = private unnamed_addr constant [135 x i8] c"{{.+}}", align 1
46+
// UNOPT: @.src = private unnamed_addr constant [{{[0-9]+}} x i8] c"{{.+}}", align 1
4747
// UNOPT: @[[GLOB0:[0-9]+]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
4848
// UNOPT: @trap.reason = private unnamed_addr constant [41 x i8] c"indexing above upper bound in 'ptr[tmp]'\00", align 4
4949
// UNOPT: @trap.reason.1 = private unnamed_addr constant [47 x i8] c"indexing overflows address space in 'ptr[tmp]'\00", align 4
5050
// UNOPT: @trap.reason.2 = private unnamed_addr constant [41 x i8] c"indexing below lower bound in 'ptr[tmp]'\00", align 4
5151
//.
52-
// UNOPT-TF: @.src = private unnamed_addr constant [135 x i8] c"{{.+}}", align 1
52+
// UNOPT-TF: @.src = private unnamed_addr constant [{{[0-9]+}} x i8] c"{{.+}}", align 1
5353
// UNOPT-TF: @[[GLOB0:[0-9]+]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
5454
// UNOPT-TF: @trap.reason = private unnamed_addr constant [41 x i8] c"indexing above upper bound in 'ptr[tmp]'\00", align 4
5555
// UNOPT-TF: @trap.reason.1 = private unnamed_addr constant [47 x i8] c"indexing overflows address space in 'ptr[tmp]'\00", align 4
5656
// UNOPT-TF: @trap.reason.2 = private unnamed_addr constant [41 x i8] c"indexing below lower bound in 'ptr[tmp]'\00", align 4
5757
//.
58-
// UNOPT-TFR: @.src = private unnamed_addr constant [135 x i8] c"{{.+}}", align 1
58+
// UNOPT-TFR: @.src = private unnamed_addr constant [{{[0-9]+}} x i8] c"{{.+}}", align 1
5959
// UNOPT-TFR: @[[GLOB0:[0-9]+]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
6060
// UNOPT-TFR: @trap.reason = private unnamed_addr constant [41 x i8] c"indexing above upper bound in 'ptr[tmp]'\00", align 4
6161
// UNOPT-TFR: @trap.reason.1 = private unnamed_addr constant [47 x i8] c"indexing overflows address space in 'ptr[tmp]'\00", align 4

0 commit comments

Comments
 (0)