| ; NOTE: Assertions have been autogenerated by utils/update_llubi_test_checks.py UTC_ARGS: --version 6 |
| ; RUN: not llubi --verbose < %s 2>&1 | FileCheck %s |
| |
| declare ptr @malloc(i64) |
| declare void @free(ptr) |
| |
| define i32 @main() { |
| %p = call ptr @malloc(i64 4) |
| %p_oob = getelementptr i8, ptr %p, i64 8 |
| call void @free(ptr %p_oob) |
| |
| ret i32 0 |
| } |
| ; CHECK: Entering function: main |
| ; CHECK-NEXT: %p = call ptr @malloc(i64 4) => ptr 0x10 [p] |
| ; CHECK-NEXT: %p_oob = getelementptr i8, ptr %p, i64 8 => ptr 0x18 [p + 8] |
| ; CHECK-NEXT: Immediate UB detected: freeing a pointer that does not point to the start of an allocation. |
| ; CHECK-NEXT: error: Execution of function 'main' failed. |