File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2469,9 +2469,6 @@ predicate exprNeedsCopyIfNotLoaded(Expr expr) {
24692469 expr instanceof PrefixCrementOperation and
24702470 not expr .isPRValueCategory ( ) // is C++
24712471 or
2472- // Because the load is on the `e` in `e++`.
2473- expr instanceof PostfixCrementOperation
2474- or
24752472 expr instanceof PointerDereferenceExpr
24762473 or
24772474 expr instanceof AddressOfExpr
@@ -2489,6 +2486,12 @@ predicate exprNeedsCopyIfNotLoaded(Expr expr) {
24892486 // TODO: simplify TranslatedStmtExpr too
24902487 ) and
24912488 not exprImmediatelyDiscarded ( expr )
2489+ or
2490+ // For certain expressions we want to keep the CopyValue instruction even though the result might
2491+ // not be needed, as we otherwise cannot get back the original expression. For now the only such
2492+ // expressions we have encountered are `e++` and `e--`.
2493+ // Because the load is on the `e` in `e++`.
2494+ expr instanceof PostfixCrementOperation
24922495}
24932496
24942497/**
You can’t perform that action at this time.
0 commit comments