Issue 75944
Summary [llc] Signed Overflow detected by UBSan.
Labels bug, backend:X86
Assignees
Reporter Ralender
    ```ll
target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128"
target triple = "i386-unknown-linux-gnu"

define void @test(ptr %0) {
 %2 = alloca [10 x i8], i32 0, align 1
  %3 = ptrtoint ptr %2 to i32
 %4 = add i32 %3, 2147483647
  br label %5

5: ; preds = %5, %1
  %6 = phi i32 [ 0, %1 ], [ %7, %5 ]
  %7 = add i32 %6, 1
  %8 = icmp eq i32 %6, %4
  br label %5
]
```
```bash
> llc out.ll
.../llvm-project/llvm/lib/Target/X86/X86RegisterInfo.cpp:945:27: runtime error: signed integer overflow: 3 + 2147483647 cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior .../llvm-project/llvm/lib/Target/X86/X86RegisterInfo.cpp:945:27 in
```
I can reproduce this on f17e76697289e6a54e89298a49f12b6799dd3e1a

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

Reply via email to