You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void f(void g(void*, void*)) {
int a[2][2];
g(&a[0x8000000000000000], a+0x8000000000000000);
}
Compile with -fsanitize=pointer-overflow, produces:
<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.
The text was updated successfully, but these errors were encountered:
void f(void g(void*, void*)) {
int a[2][2];
g(&a[0x8000000000000000], a+0x8000000000000000);
}
Compile with -fsanitize=pointer-overflow, produces:
<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.
Testcase:
Compile with -fsanitize=pointer-overflow, produces:
The text was updated successfully, but these errors were encountered: