We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8cfa0a3 commit 2f793f6Copy full SHA for 2f793f6
1 file changed
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll
@@ -62,10 +62,16 @@ private predicate ignoreConstantValue(Operation op) {
62
op instanceof BitwiseXorExpr
63
}
64
65
-/** Holds if `expr` contains an address-of expression that EDG may have constant-folded. */
+/**
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
+ */
70
private predicate containsAddressOf(Expr expr) {
71
expr instanceof AddressOfExpr
72
or
73
+ not expr instanceof SizeofOperator and
74
+ not expr instanceof AlignofOperator and
75
containsAddressOf(expr.getAChild())
76
77
0 commit comments