[llvm][CodeGen] codegen doesn't respect over-aligned allocations
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
For the following IR, llubi executes the program normally, but the binary compiled by clang crashes with a segmentation fault.
### IR Program
```llvm
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:64:64-i64:64:64"
define void @main() {
%a = alloca [2 x i32]
store <4 x i32> zeroinitializer, ptr %a, align 8
ret void
}
```
### Running Result
```console
$ llubi --verbose ./test.ll
Entering function: main
%a = alloca [2 x i32], align 8 => ptr 0x8 [a]
store <4 x i32> zeroinitializer, ptr %a, align 8
ret void
Exiting function: main
$ clang ./test.ll
$ ls
a.out test.ll
$ ./a.out
Segmentation fault ./a.out
```
Version: f8ca8fcb9924b93d1d3b8694f85968f6bdb65ec0
cc: @dtcxzyw
Contributor guide
Research direction
Start with the provided IR reproducer and compare its execution under llubi and clang at commit f8ca8fcb9924b93d1d3b8694f85968f6bdb65ec0. Trace the CodeGen handling of the over-aligned alloca and store. Done means compiling and running this program no longer segfaults and the requested alignment is respected.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100