Skip to content

Commit 77cd164

Browse files
committed
Merge remote-tracking branch 'origin/GT-3315_GlobalStringAssign' into patch
2 parents 0b6b7fa + f2dcd48 commit 77cd164

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6370,15 +6370,18 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data)
63706370
if (!isstring) return 0;
63716371

63726372
// If we reach here, the PTRSUB should be converted to a (COPY of a) pointer constant.
6373-
list<PcodeOp *>::const_iterator iter,enditer;
6374-
iter = outvn->beginDescend();
6375-
enditer = outvn->endDescend();
6376-
bool removeCopy = true;
6377-
while(iter != enditer) {
6378-
PcodeOp *subop = *iter; // Give each descendant of op a chance to further propagate the constant
6379-
++iter;
6380-
if (!pushConstFurther(data,outtype,subop,subop->getSlot(outvn),vn1->getOffset()))
6381-
removeCopy = false; // If the descendant does NOT propagate const, do NOT remove op
6373+
bool removeCopy = false;
6374+
if (!outvn->isAddrForce()) {
6375+
removeCopy = true; // Assume we can remove, unless we can't propagate to all descendants
6376+
list<PcodeOp *>::const_iterator iter,enditer;
6377+
iter = outvn->beginDescend();
6378+
enditer = outvn->endDescend();
6379+
while(iter != enditer) {
6380+
PcodeOp *subop = *iter; // Give each descendant of op a chance to further propagate the constant
6381+
++iter;
6382+
if (!pushConstFurther(data,outtype,subop,subop->getSlot(outvn),vn1->getOffset()))
6383+
removeCopy = false; // If the descendant does NOT propagate const, do NOT remove op
6384+
}
63826385
}
63836386
if (removeCopy) {
63846387
data.opDestroy(op);

0 commit comments

Comments
 (0)