Skip to content

Commit fa06b6d

Browse files
authored
Use temporary binding for memory access base of bounds cast expressions (#715)
* Set the access base for bounds_cast(e) to a temp binding of e * Use isa instead of dyn_cast
1 parent e3be202 commit fa06b6d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

clang/lib/Sema/SemaBounds.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,6 +2425,10 @@ namespace {
24252425
if (SplitIntoBaseAndOffset(PtrBase, AccessBase, AccessStartOffset, DummyOffset) != BaseRange::Kind::ConstantSized)
24262426
return ProofResult::Maybe;
24272427

2428+
// The access base for bounds_cast(e) should be a temporary binding of e.
2429+
if (isa<BoundsCastExpr>(AccessBase))
2430+
AccessBase = GetTempBinding(AccessBase);
2431+
24282432
if (Offset) {
24292433
llvm::APSInt IntVal;
24302434
if (!Offset->isIntegerConstantExpr(IntVal, S.Context))

0 commit comments

Comments
 (0)