forked from anza-xyz/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.
Error when we overwrite data on the stack
- Loading branch information
Showing
4 changed files
with
81 additions
and
20 deletions.
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,46 @@ | ||
; RUN: not --crash llc < %s -march=sbf 2>&1 | FileCheck %s | ||
|
||
; Function Attrs: noinline nounwind optnone ssp uwtable(sync) | ||
define i32 @func(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #0 { | ||
ret i32 %2 | ||
} | ||
|
||
; Function Attrs: noinline nounwind optnone ssp uwtable(sync) | ||
define i32 @func1(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 { | ||
%5 = alloca i32, align 4 | ||
%6 = alloca i32, align 4 | ||
%7 = alloca i32, align 4 | ||
%8 = alloca i32, align 4 | ||
%9 = alloca [4070 x i8], align 1 | ||
store i32 %0, ptr %5, align 4 | ||
store i32 %1, ptr %6, align 4 | ||
store i32 %2, ptr %7, align 4 | ||
store i32 %3, ptr %8, align 4 | ||
%10 = load i32, ptr %5, align 4 | ||
%11 = load i32, ptr %6, align 4 | ||
%12 = load i32, ptr %7, align 4 | ||
%13 = load i32, ptr %8, align 4 | ||
%14 = getelementptr inbounds [4070 x i8], ptr %9, i64 0, i64 5 | ||
%15 = load i8, ptr %14, align 1 | ||
%16 = sext i8 %15 to i32 | ||
%17 = getelementptr inbounds [4070 x i8], ptr %9, i64 0, i64 9 | ||
%18 = load i8, ptr %17, align 1 | ||
%19 = sext i8 %18 to i32 | ||
%20 = call i32 @func(i32 noundef %10, i32 noundef %11, i32 noundef %12, i32 noundef %13, i32 noundef %16, i32 noundef %19) | ||
ret i32 %20 | ||
|
||
; CHECK: A function call in method func1 overwrites values in the frame. | ||
; CHECK: Please, decrease stack usage or remove parameters from the call. | ||
; CHECK: The function call may cause undefined behavior during execution. | ||
} | ||
|
||
|
||
attributes #0 = { noinline nounwind optnone ssp uwtable(sync) "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" } | ||
|
||
!llvm.module.flags = !{!0, !1, !2, !3, !4} | ||
|
||
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 14, i32 4]} | ||
!1 = !{i32 1, !"wchar_size", i32 4} | ||
!2 = !{i32 8, !"PIC Level", i32 2} | ||
!3 = !{i32 7, !"uwtable", i32 1} | ||
!4 = !{i32 7, !"frame-pointer", i32 1} |
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