@@ -496,7 +496,6 @@ expr Pointer::encodeLoadedByteRefined(
496496expr Pointer::encodeLocalPtrRefinement (
497497 const Pointer &other, set<expr> &undefs) const {
498498 expr tgt_bid = other.getShortBid ();
499-
500499 expr ofs = expr::mkFreshVar (" localblk_ofs" , expr::mkUInt (0 , bits_for_offset));
501500 Pointer this_ofs = *this + ofs;
502501 Pointer other_ofs = other + ofs;
@@ -505,15 +504,19 @@ expr Pointer::encodeLocalPtrRefinement(
505504 bool is_const_bid = this_ofs.getShortBid ().isUInt (bid_const) &&
506505 tgt_bid.isUInt (bid_tgt_const);
507506 expr blkrefined;
508- if (is_const_bid)
509- // Look into the bytes
507+ if (is_const_bid && this ->isByval ().isFalse () && other.isByval ().isFalse ()) {
508+ // Look into the bytes.
509+ // If this or other pointer is byval, blockRefined cannot be used because
510+ // it requires both bids to be local or nonlocal
511+ // In the byval case, return the approximated result by simply checking
512+ // the block properties in the else clause below
510513 blkrefined = m.blockRefined (*this , other, (unsigned )bid_const,
511514 (unsigned )bid_tgt_const, undefs);
512- else
515+ } else
513516 blkrefined = m.blockPropertiesRefined (*this , other);
514517
515- return other.isLocal () && getOffset () == other.getOffset ( ) &&
516- move (blkrefined);
518+ return ( other.isLocal () || other.isByval () ) &&
519+ getOffset () == other. getOffset () && move (blkrefined);
517520}
518521
519522expr Pointer::encodeByValArgRefinement (
@@ -540,7 +543,8 @@ expr Pointer::fninputRefined(const Pointer &other, set<expr> &undef,
540543
541544 expr islocal = isLocal ();
542545 expr local = false ;
543- if (!islocal.isFalse () && !other.isLocal ().isFalse ())
546+ if (!islocal.isFalse () &&
547+ (!other.isLocal ().isFalse () || !other.isByval ().isFalse ()))
544548 local = encodeLocalPtrRefinement (other, undef);
545549
546550 local = (other.isLocal () || other.isByval ()) && local;
0 commit comments