@@ -497,7 +497,6 @@ expr Pointer::encodeLoadedByteRefined(
497497expr Pointer::encodeLocalPtrRefinement (
498498 const Pointer &other, set<expr> &undefs) const {
499499 expr tgt_bid = other.getShortBid ();
500-
501500 expr ofs = expr::mkFreshVar (" localblk_ofs" , expr::mkUInt (0 , bits_for_offset));
502501 Pointer this_ofs = *this + ofs;
503502 Pointer other_ofs = other + ofs;
@@ -506,15 +505,19 @@ expr Pointer::encodeLocalPtrRefinement(
506505 bool is_const_bid = this_ofs.getShortBid ().isUInt (bid_const) &&
507506 tgt_bid.isUInt (bid_tgt_const);
508507 expr blkrefined;
509- if (is_const_bid)
510- // Look into the bytes
508+ if (is_const_bid && this ->isByval ().isFalse () && other.isByval ().isFalse ()) {
509+ // Look into the bytes.
510+ // If this or other pointer is byval, blockRefined cannot be used because
511+ // it requires both bids to be local or nonlocal
512+ // In the byval case, return the approximated result by simply checking
513+ // the block properties in the else clause below
511514 blkrefined = m.blockRefined (*this , other, (unsigned )bid_const,
512515 (unsigned )bid_tgt_const, undefs);
513- else
516+ } else
514517 blkrefined = m.blockPropertiesRefined (*this , other);
515518
516- return other.isLocal () && getOffset () == other.getOffset ( ) &&
517- move (blkrefined);
519+ return ( other.isLocal () || other.isByval () ) &&
520+ getOffset () == other. getOffset () && move (blkrefined);
518521}
519522
520523expr Pointer::encodeByValArgRefinement (
@@ -541,7 +544,8 @@ expr Pointer::fninputRefined(const Pointer &other, set<expr> &undef,
541544
542545 expr islocal = isLocal ();
543546 expr local = false ;
544- if (!islocal.isFalse () && !other.isLocal ().isFalse ())
547+ if (!islocal.isFalse () &&
548+ (!other.isLocal ().isFalse () || !other.isByval ().isFalse ()))
545549 local = encodeLocalPtrRefinement (other, undef);
546550
547551 local = (other.isLocal () || other.isByval ()) && local;
0 commit comments