File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -62,10 +62,16 @@ private predicate ignoreConstantValue(Operation op) {
6262 op instanceof BitwiseXorExpr
6363}
6464
65- /** Holds if `expr` contains an address-of expression that EDG may have constant-folded. */
65+ /**
66+ * Holds if `expr` contains an address-of expression that EDG may have constant-folded.
67+ * We don't recurse into `sizeof` or `alignof` since they don't evaluate their operands,
68+ * so any address-of inside them doesn't affect actual execution.
69+ */
6670private predicate containsAddressOf ( Expr expr ) {
6771 expr instanceof AddressOfExpr
6872 or
73+ not expr instanceof SizeofOperator and
74+ not expr instanceof AlignofOperator and
6975 containsAddressOf ( expr .getAChild ( ) )
7076}
7177
You can’t perform that action at this time.
0 commit comments