forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TySan] Added a 'print_stacktrace' flag for more detailed errors (llv…
…m#121756) Raised in issue llvm#121697
- Loading branch information
1 parent
9d06651
commit 5f1bd29
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %clang_tysan -O0 %s -o %t && %run %t >%t.out 2>&1 | ||
// RUN: FileCheck --check-prefixes=CHECK,CHECK-SHORT %s < %t.out | ||
|
||
// RUN: %env_tysan_opts=print_stacktrace=1 %run %t >%t.out 2>&1 | ||
// RUN: FileCheck --check-prefixes=CHECK,CHECK-LONG %s < %t.out | ||
|
||
float *P; | ||
void zero_array() { | ||
int i; | ||
for (i = 0; i < 1; ++i) | ||
P[i] = 0.0f; | ||
// CHECK: ERROR: TypeSanitizer: type-aliasing-violation | ||
// CHECK: WRITE of size 4 at {{.*}} with type float accesses an existing object of type p1 float | ||
// CHECK: {{#0 0x.* in zero_array .*print_stacktrace.c:}}[[@LINE-3]] | ||
// CHECK-SHORT-NOT: {{#1 0x.* in main .*print_stacktrace.c}} | ||
// CHECK-LONG-NEXT: {{#1 0x.* in main .*print_stacktrace.c}} | ||
} | ||
|
||
int main() { | ||
P = (float *)&P; | ||
zero_array(); | ||
} |