@@ -497,7 +497,6 @@ expr Pointer::encodeLoadedByteRefined(
497
497
expr Pointer::encodeLocalPtrRefinement (
498
498
const Pointer &other, set<expr> &undefs) const {
499
499
expr tgt_bid = other.getShortBid ();
500
-
501
500
expr ofs = expr::mkFreshVar (" localblk_ofs" , expr::mkUInt (0 , bits_for_offset));
502
501
Pointer this_ofs = *this + ofs;
503
502
Pointer other_ofs = other + ofs;
@@ -506,15 +505,19 @@ expr Pointer::encodeLocalPtrRefinement(
506
505
bool is_const_bid = this_ofs.getShortBid ().isUInt (bid_const) &&
507
506
tgt_bid.isUInt (bid_tgt_const);
508
507
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
511
514
blkrefined = m.blockRefined (*this , other, (unsigned )bid_const,
512
515
(unsigned )bid_tgt_const, undefs);
513
- else
516
+ } else
514
517
blkrefined = m.blockPropertiesRefined (*this , other);
515
518
516
- return other.isLocal () && getOffset () == other.getOffset ( ) &&
517
- move (blkrefined);
519
+ return ( other.isLocal () || other.isByval () ) &&
520
+ getOffset () == other. getOffset () && move (blkrefined);
518
521
}
519
522
520
523
expr Pointer::encodeByValArgRefinement (
@@ -541,7 +544,8 @@ expr Pointer::fninputRefined(const Pointer &other, set<expr> &undef,
541
544
542
545
expr islocal = isLocal ();
543
546
expr local = false ;
544
- if (!islocal.isFalse () && !other.isLocal ().isFalse ())
547
+ if (!islocal.isFalse () &&
548
+ (!other.isLocal ().isFalse () || !other.isByval ().isFalse ()))
545
549
local = encodeLocalPtrRefinement (other, undef);
546
550
547
551
local = (other.isLocal () || other.isByval ()) && local;
0 commit comments