Issue 235437
Summary llubi accepts allocations that violate DataLayout object bounds
Labels new issue
Assignees
Reporter Roticv912
    With an 8-bit pointer index and address space, llubi accepts an object larger than the signed index limit and an object whose one-past-end address exceeds the address space.

### Program 1
The 128-byte object exceeds the 8-bit index type's maximum signed value of 127, but Output 1 shows that llubi accepts the allocation and returns normally.
```llvm
target datalayout = "e-p:8:8:8:8"

define i32 @main() {
entry:
  %p = alloca [128 x i8], align 1
  ret i32 0
}
```
### Output1
```
Entering function: main
  %p = alloca [128 x i8], align 1 => ptr 0x8 [p]
  ret i32 0
Exiting function: main
```
### Program2
Both objects are 127 bytes, but Output 2 places %q at 0x88 (136), giving it a one-past-end address of 136 + 127 = 263, beyond the 8-bit address limit of 255; llubi still returns normally.
```llvm
target datalayout = "e-p:8:8:8:8"

define i32 @main() {
entry:
  %p = alloca [127 x i8], align 1
  %q = alloca [127 x i8], align 1
  ret i32 0
}
```

### Output2
```
Entering function: main
  %p = alloca [127 x i8], align 1 => ptr 0x8 [p]
  %q = alloca [127 x i8], align 1 => ptr 0x88 [q]
  ret i32 0
Exiting function: main
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to