From 2227d6d4e7bad4aca0871676df5926e51d69597e Mon Sep 17 00:00:00 2001 From: Ethan Mahintorabi Date: Tue, 11 Feb 2025 22:04:24 +0000 Subject: [PATCH] nf: Fix assert( pDp->F < FLT_MAX ); in nf This error was triggered by what appears to be a missing saturating float check in Nf_ManCutMatchOne. When opened in the debugger AreaF starts at FLT_MAX and in some cases can be added to itself which results in +Inf. I noticed the other if had a saturating condidtion. I took a flyer on it, and added it to the previous condition, and it resolved the error. I think this is a good fix. Signed-off-by: Ethan Mahintorabi --- src/aig/gia/giaNf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/aig/gia/giaNf.c b/src/aig/gia/giaNf.c index f41d8dd49..eca59120c 100644 --- a/src/aig/gia/giaNf.c +++ b/src/aig/gia/giaNf.c @@ -1172,7 +1172,10 @@ void Nf_ManCutMatchOne( Nf_Man_t * p, int iObj, int * pCut, int * pCutSet ) if ( ArrivalA + pC->iDelays[k] <= Required && Required != SCL_INFINITY ) { Delay = Abc_MaxInt( Delay, ArrivalA + pC->iDelays[k] ); - AreaF += pBestF[iFanin]->M[fComplF][1].F; + if ( AreaF >= (float)1e32 || pBestF[iFanin]->M[fComplF][1].F >= (float)1e32 ) + AreaF = (float)1e32; + else + AreaF += pBestF[iFanin]->M[fComplF][1].F; } else {