Skip to content

Commit afb1b8f

Browse files
bjjwwangclaude
andcommitted
Fix assertion errors in AE for multi-entry analysis
1. Fix BufOverflowDetector assertion (AEDetector.cpp:482) - When a variable is not an address type in multi-entry analysis, conservatively return true (assume safe) instead of asserting 2. Fix undefined compare predicate assertion (AbstractInterpretation.cpp) - Add support for FCMP_ORD and FCMP_UNO floating-point comparisons - These predicates check for NaN conditions, conservatively return [0,1] Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 2aa167c commit afb1b8f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

svf/lib/AE/Svfexe/AEDetector.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,12 @@ bool BufOverflowDetector::canSafelyAccessMemory(AbstractState& as, const SVF::SV
479479
SVFIR* svfir = PAG::getPAG();
480480
NodeID value_id = value->getId();
481481

482-
assert(as[value_id].isAddr());
482+
// In multi-entry analysis, some variables may not be initialized as addresses
483+
if (!as[value_id].isAddr())
484+
{
485+
// Conservatively assume safe when we don't have address information
486+
return true;
487+
}
483488
for (const auto& addr : as[value_id].getAddrs())
484489
{
485490
NodeID objId = as.getIDFromAddr(addr);

svf/lib/AE/Svfexe/AbstractInterpretation.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,6 +1739,13 @@ void AbstractInterpretation::updateStateOnCmp(const CmpStmt *cmp)
17391739
case CmpStmt::FCMP_TRUE:
17401740
resVal = IntervalValue(1, 1);
17411741
break;
1742+
case CmpStmt::FCMP_ORD:
1743+
case CmpStmt::FCMP_UNO:
1744+
// FCMP_ORD: true if both operands are not NaN
1745+
// FCMP_UNO: true if either operand is NaN
1746+
// Conservatively return [0, 1] since we don't track NaN
1747+
resVal = IntervalValue(0, 1);
1748+
break;
17421749
default:
17431750
assert(false && "undefined compare: ");
17441751
}
@@ -1853,6 +1860,13 @@ void AbstractInterpretation::updateStateOnCmp(const CmpStmt *cmp)
18531860
case CmpStmt::FCMP_TRUE:
18541861
resVal = IntervalValue(1, 1);
18551862
break;
1863+
case CmpStmt::FCMP_ORD:
1864+
case CmpStmt::FCMP_UNO:
1865+
// FCMP_ORD: true if both operands are not NaN
1866+
// FCMP_UNO: true if either operand is NaN
1867+
// Conservatively return [0, 1] since we don't track NaN
1868+
resVal = IntervalValue(0, 1);
1869+
break;
18561870
default:
18571871
assert(false && "undefined compare: ");
18581872
}

0 commit comments

Comments
 (0)