From 2e9284d460183e649947b706b8fd99943ed88688 Mon Sep 17 00:00:00 2001 From: Michael Schwarz Date: Mon, 29 Jan 2024 15:33:09 +0100 Subject: [PATCH] Fix for issue #1342 caused regression for #1338 --- src/analyses/apron/relationAnalysis.apron.ml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/analyses/apron/relationAnalysis.apron.ml b/src/analyses/apron/relationAnalysis.apron.ml index 9df2360482..ea570b338a 100644 --- a/src/analyses/apron/relationAnalysis.apron.ml +++ b/src/analyses/apron/relationAnalysis.apron.ml @@ -219,14 +219,17 @@ struct begin match ask (Queries.MayPointTo e) with | ad when not (Queries.AD.is_top ad) && (Queries.AD.cardinal ad) = 1 -> let replace mval = - let pointee = ValueDomain.Addr.Mval.to_cil_exp mval in - let pointee_typ = Cil.typeSig @@ Cilfacade.typeOf pointee in - let lval_typ = Cil.typeSig @@ Cilfacade.typeOfLval (Mem e, NoOffset) in - if pointee_typ = lval_typ then - Some pointee - else - (* there is a type-mismatch between pointee and pointer-type *) - (* to avoid mismatch errors, we bail on this expression *) + try + let pointee = ValueDomain.Addr.Mval.to_cil_exp mval in + let pointee_typ = Cil.typeSig @@ Cilfacade.typeOf pointee in + let lval_typ = Cil.typeSig @@ Cilfacade.typeOfLval (Mem e, NoOffset) in + if pointee_typ = lval_typ then + Some pointee + else + (* there is a type-mismatch between pointee and pointer-type *) + (* to avoid mismatch errors, we bail on this expression *) + None + with Cilfacade.TypeOfError _ -> None in let r = Option.bind (Queries.AD.Addr.to_mval (Queries.AD.choose ad)) replace in