Issue 124357
Summary Assertion with overflowing pointer with -fsanitize=pointer-overflow
Labels new issue
Assignees
Reporter efriedma-quic
    Testcase:

```
void f(void g(void*, void*)) {
  int a[2][2];
  g(&a[0x8000000000000000], a+0x8000000000000000);
}
```

```
<stdin>:1:59: warning: array index -9223372036854775808 is past the end of the array (that has type 'int[2][2]') [-Warray-bounds]
    1 | void f(void g(void*, void*)) { int x = 2; int a[2][2]; g(&a[0x8000000000000000], a+0x8000000000000000); }
      | ^ ~~~~~~~~~~~~~~~~~~
<stdin>:1:43: note: array 'a' declared here
    1 | void f(void g(void*, void*)) { int x = 2; int a[2][2]; g(&a[0x8000000000000000], a+0x8000000000000000); }
      | ^
clang: /usr2/efriedma/local/upstream/llvm-top/clang/lib/CodeGen/CGExprScalar.cpp:5837: llvm::Value *clang::CodeGen::CodeGenFunction::EmitCheckedInBoundsGEP(llvm::Type *, llvm::Value *, ArrayRef<llvm::Value *>, bool, bool, clang::SourceLocation, const llvm::Twine &): Assertion `(!isa<llvm::Constant>(EvaluatedGEP.TotalOffset) || EvaluatedGEP.OffsetOverflows == Builder.getFalse()) && "If the offset got constant-folded, we don't expect that there was an " "overflow."' failed.
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to