Skip to content

Commit 49ff0bd

Browse files
committed
No CFG nodes for subexprs of const exprs
In Go, sub-expressions of a constant expression are folded at compile time and never evaluated at runtime, so they shouldn't get evaluation nodes.
1 parent fdc4468 commit 49ff0bd

4 files changed

Lines changed: 61 additions & 116 deletions

File tree

go/ql/lib/semmle/go/controlflow/ControlFlowGraphShared.qll

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ module CfgImpl {
3030
Input::implicitFieldSelection(e, index, implicitField)
3131
}
3232

33+
/**
34+
* Holds if `root` is a constant root: a constant expression (with any
35+
* enclosing parentheses stripped) whose parent expression is not itself
36+
* constant. The strict sub-expressions of a constant root are folded at
37+
* compile time and are not evaluated at run time, so they get no evaluation
38+
* node; the constant root itself is evaluated as a single leaf value.
39+
*/
40+
private predicate constantRoot(Go::Expr root) {
41+
exists(Go::Expr c |
42+
c.isConst() and
43+
not c.getParent().(Go::Expr).isConst() and
44+
root = c.stripParens()
45+
)
46+
}
47+
3348
/** Provides an implementation of the AST signature for Go. */
3449
private module Ast implements CfgLib::AstSig<Go::Location> {
3550
class AstNode = Go::AstNode;
@@ -78,6 +93,10 @@ module CfgImpl {
7893
// the switch expression (see `Switch.getExpr`), so the wrapping
7994
// statement must not introduce its own assignment or expression nodes.
8095
e = any(Go::TypeSwitchStmt ts).getTest()
96+
or
97+
// The strict sub-expressions of a constant expression are not evaluated
98+
// at run time, so they must not get their own evaluation nodes.
99+
constantRoot(e.(Go::Expr).getParent+())
81100
}
82101

83102
AstNode getChild(AstNode n, int index) {
@@ -345,17 +364,29 @@ module CfgImpl {
345364

346365
class BinaryExpr = Go::BinaryExpr;
347366

348-
class LogicalAndExpr = Go::LandExpr;
367+
// Constant short-circuiting operators are folded at compile time and their
368+
// operands are not evaluated at run time, so they are not treated as
369+
// logical operators here (which would give their operands their own
370+
// evaluation nodes via `getLeftOperand`/`getRightOperand`/`getOperand`,
371+
// bypassing `skipCfg`). Instead they are handled as constant-root leaf
372+
// value nodes (see `postOrInOrder`).
373+
class LogicalAndExpr extends Go::LandExpr {
374+
LogicalAndExpr() { not this.isConst() }
375+
}
349376

350-
class LogicalOrExpr = Go::LorExpr;
377+
class LogicalOrExpr extends Go::LorExpr {
378+
LogicalOrExpr() { not this.isConst() }
379+
}
351380

352381
class NullCoalescingExpr extends BinaryExpr {
353382
NullCoalescingExpr() { none() }
354383
}
355384

356385
class UnaryExpr = Go::UnaryExpr;
357386

358-
class LogicalNotExpr = Go::NotExpr;
387+
class LogicalNotExpr extends Go::NotExpr {
388+
LogicalNotExpr() { not this.isConst() }
389+
}
359390

360391
class BooleanLiteral extends Expr {
361392
boolean val;
@@ -473,6 +504,13 @@ module CfgImpl {
473504
// needs an explicit in-order (allocation) node.
474505
n instanceof Go::CompositeLit
475506
or
507+
// A constant expression is folded at compile time and its sub-expressions
508+
// are not evaluated (they are pruned by `skipCfg`), so the constant root
509+
// has no CFG children. It therefore needs an explicit in-order node to
510+
// remain a single value-producing leaf (e.g. `unsafe.Sizeof(test())`,
511+
// `1 << 10`, or `!d` for constant `d`).
512+
constantRoot(n)
513+
or
476514
// Statements/declarations that compute a value or perform an operation and
477515
// are not among the statements the shared library makes post-order by
478516
// default.

go/ql/lib/semmle/go/controlflow/IR.qll

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,16 @@ module IR {
243243
// `defer-invoke` node that models the call at function exit.
244244
this.isAdditional(e, "defer-invoke")
245245
or
246-
// `NotExpr` and `LogicalBinaryExpr` are not in `postOrInOrder`, so they
247-
// don't have an `isIn` node. Only use the after-node when the
248-
// expression is not in a conditional context; otherwise the value is
249-
// split across `TAfterValueNode`s per branch and should not be exposed
250-
// as a single value-producing instruction.
246+
// Non-constant `NotExpr` and `LogicalBinaryExpr` are not in
247+
// `postOrInOrder`, so they don't have an `isIn` node; their value is
248+
// produced by the after-node. (Constant ones are folded and get a leaf
249+
// `isIn` node via `constRoot`, handled by the first disjunct above, so
250+
// they are excluded here to avoid a duplicate value node.) Only use the
251+
// after-node when the expression is not in a conditional context;
252+
// otherwise the value is split across `TAfterValueNode`s per branch and
253+
// should not be exposed as a single value-producing instruction.
251254
(e instanceof NotExpr or e instanceof LogicalBinaryExpr) and
255+
not e.isConst() and
252256
not isInBooleanCondContext(e) and
253257
this.isAfter(e)
254258
}

go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.expected

Lines changed: 10 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,7 @@
557557
| epilogues.go:90:4:90:14 | assign:0 ... = ... | epilogues.go:90:4:90:14 | After ... = ... |
558558
| epilogues.go:90:13:90:14 | -... | epilogues.go:90:13:90:14 | After -... |
559559
| epilogues.go:90:13:90:14 | After -... | epilogues.go:90:4:90:14 | assign:0 ... = ... |
560-
| epilogues.go:90:13:90:14 | Before -... | epilogues.go:90:14:90:14 | Before 1 |
561-
| epilogues.go:90:14:90:14 | 1 | epilogues.go:90:14:90:14 | After 1 |
562-
| epilogues.go:90:14:90:14 | After 1 | epilogues.go:90:13:90:14 | -... |
563-
| epilogues.go:90:14:90:14 | Before 1 | epilogues.go:90:14:90:14 | 1 |
560+
| epilogues.go:90:13:90:14 | Before -... | epilogues.go:90:13:90:14 | -... |
564561
| epilogues.go:93:2:95:2 | After if statement | epilogues.go:96:2:96:15 | ... = ... |
565562
| epilogues.go:93:2:95:2 | if statement | epilogues.go:93:5:93:9 | Before ...<... |
566563
| epilogues.go:93:5:93:5 | After x | epilogues.go:93:9:93:9 | Before 0 |
@@ -814,23 +811,9 @@
814811
| exprs.go:6:13:6:13 | 0 | exprs.go:6:13:6:13 | After 0 |
815812
| exprs.go:6:13:6:13 | After 0 | exprs.go:6:16:6:26 | Before ...+... |
816813
| exprs.go:6:13:6:13 | Before 0 | exprs.go:6:13:6:13 | 0 |
817-
| exprs.go:6:16:6:16 | 1 | exprs.go:6:16:6:16 | After 1 |
818-
| exprs.go:6:16:6:16 | After 1 | exprs.go:6:20:6:26 | (...) |
819-
| exprs.go:6:16:6:16 | Before 1 | exprs.go:6:16:6:16 | 1 |
820814
| exprs.go:6:16:6:26 | ...+... | exprs.go:6:16:6:26 | After ...+... |
821815
| exprs.go:6:16:6:26 | After ...+... | exprs.go:6:6:6:26 | assign:0 value declaration specifier |
822-
| exprs.go:6:16:6:26 | Before ...+... | exprs.go:6:16:6:16 | Before 1 |
823-
| exprs.go:6:20:6:26 | (...) | exprs.go:6:21:6:25 | Before ...+... |
824-
| exprs.go:6:20:6:26 | After (...) | exprs.go:6:16:6:26 | ...+... |
825-
| exprs.go:6:21:6:21 | 2 | exprs.go:6:21:6:21 | After 2 |
826-
| exprs.go:6:21:6:21 | After 2 | exprs.go:6:25:6:25 | Before 3 |
827-
| exprs.go:6:21:6:21 | Before 2 | exprs.go:6:21:6:21 | 2 |
828-
| exprs.go:6:21:6:25 | ...+... | exprs.go:6:21:6:25 | After ...+... |
829-
| exprs.go:6:21:6:25 | After ...+... | exprs.go:6:20:6:26 | After (...) |
830-
| exprs.go:6:21:6:25 | Before ...+... | exprs.go:6:21:6:21 | Before 2 |
831-
| exprs.go:6:25:6:25 | 3 | exprs.go:6:25:6:25 | After 3 |
832-
| exprs.go:6:25:6:25 | After 3 | exprs.go:6:21:6:25 | ...+... |
833-
| exprs.go:6:25:6:25 | Before 3 | exprs.go:6:25:6:25 | 3 |
816+
| exprs.go:6:16:6:26 | Before ...+... | exprs.go:6:16:6:26 | ...+... |
834817
| exprs.go:7:2:7:16 | After declaration statement | exprs.go:8:2:8:24 | ... := ... |
835818
| exprs.go:7:2:7:16 | After variable declaration | exprs.go:7:2:7:16 | After declaration statement |
836819
| exprs.go:7:2:7:16 | declaration statement | exprs.go:7:2:7:16 | variable declaration |
@@ -930,15 +913,9 @@
930913
| exprs.go:14:13:14:13 | After j | exprs.go:14:16:14:19 | Before .../... |
931914
| exprs.go:14:13:14:13 | Before j | exprs.go:14:13:14:13 | j |
932915
| exprs.go:14:13:14:13 | j | exprs.go:14:13:14:13 | After j |
933-
| exprs.go:14:16:14:16 | 3 | exprs.go:14:16:14:16 | After 3 |
934-
| exprs.go:14:16:14:16 | After 3 | exprs.go:14:18:14:19 | Before 14 |
935-
| exprs.go:14:16:14:16 | Before 3 | exprs.go:14:16:14:16 | 3 |
936916
| exprs.go:14:16:14:19 | .../... | exprs.go:14:16:14:19 | After .../... |
937917
| exprs.go:14:16:14:19 | After .../... | exprs.go:14:7:14:20 | call to fn |
938-
| exprs.go:14:16:14:19 | Before .../... | exprs.go:14:16:14:16 | Before 3 |
939-
| exprs.go:14:18:14:19 | 14 | exprs.go:14:18:14:19 | After 14 |
940-
| exprs.go:14:18:14:19 | After 14 | exprs.go:14:16:14:19 | .../... |
941-
| exprs.go:14:18:14:19 | Before 14 | exprs.go:14:18:14:19 | 14 |
918+
| exprs.go:14:16:14:19 | Before .../... | exprs.go:14:16:14:19 | .../... |
942919
| exprs.go:15:2:15:58 | ... := ... | exprs.go:15:13:15:58 | Before struct literal |
943920
| exprs.go:15:2:15:58 | After ... := ... | exprs.go:16:2:16:26 | ... := ... |
944921
| exprs.go:15:2:15:58 | assign:0 ... := ... | exprs.go:15:2:15:58 | After ... := ... |
@@ -1214,10 +1191,7 @@
12141191
| exprs.go:36:2:36:10 | return statement | exprs.go:32:1:37:1 | Normal Exit |
12151192
| exprs.go:36:9:36:10 | -... | exprs.go:36:9:36:10 | After -... |
12161193
| exprs.go:36:9:36:10 | After -... | exprs.go:36:2:36:10 | return statement |
1217-
| exprs.go:36:9:36:10 | Before -... | exprs.go:36:10:36:10 | Before 1 |
1218-
| exprs.go:36:10:36:10 | 1 | exprs.go:36:10:36:10 | After 1 |
1219-
| exprs.go:36:10:36:10 | After 1 | exprs.go:36:9:36:10 | -... |
1220-
| exprs.go:36:10:36:10 | Before 1 | exprs.go:36:10:36:10 | 1 |
1194+
| exprs.go:36:9:36:10 | Before -... | exprs.go:36:9:36:10 | -... |
12211195
| exprs.go:39:1:47:1 | After function declaration | exprs.go:49:1:54:1 | Before function declaration |
12221196
| exprs.go:39:1:47:1 | Before function declaration | exprs.go:39:1:47:1 | function declaration |
12231197
| exprs.go:39:1:47:1 | Entry | exprs.go:39:12:39:14 | arg |
@@ -1269,10 +1243,7 @@
12691243
| exprs.go:46:2:46:10 | return statement | exprs.go:39:1:47:1 | Normal Exit |
12701244
| exprs.go:46:9:46:10 | -... | exprs.go:46:9:46:10 | After -... |
12711245
| exprs.go:46:9:46:10 | After -... | exprs.go:46:2:46:10 | return statement |
1272-
| exprs.go:46:9:46:10 | Before -... | exprs.go:46:10:46:10 | Before 1 |
1273-
| exprs.go:46:10:46:10 | 1 | exprs.go:46:10:46:10 | After 1 |
1274-
| exprs.go:46:10:46:10 | After 1 | exprs.go:46:9:46:10 | -... |
1275-
| exprs.go:46:10:46:10 | Before 1 | exprs.go:46:10:46:10 | 1 |
1246+
| exprs.go:46:9:46:10 | Before -... | exprs.go:46:9:46:10 | -... |
12761247
| exprs.go:49:1:54:1 | After function declaration | exprs.go:56:1:58:1 | Before function declaration |
12771248
| exprs.go:49:1:54:1 | Before function declaration | exprs.go:49:1:54:1 | function declaration |
12781249
| exprs.go:49:1:54:1 | Entry | exprs.go:49:10:49:11 | xs |
@@ -1561,19 +1532,13 @@
15611532
| exprs.go:91:9:91:25 | After slice literal | exprs.go:91:5:91:25 | assign:0 value declaration specifier |
15621533
| exprs.go:91:9:91:25 | Before slice literal | exprs.go:91:9:91:25 | slice literal |
15631534
| exprs.go:91:9:91:25 | slice literal | exprs.go:91:15:91:24 | Before key-value pair |
1564-
| exprs.go:91:15:91:15 | 0 | exprs.go:91:15:91:15 | After 0 |
1565-
| exprs.go:91:15:91:15 | After 0 | exprs.go:91:19:91:21 | Before one |
1566-
| exprs.go:91:15:91:15 | Before 0 | exprs.go:91:15:91:15 | 0 |
15671535
| exprs.go:91:15:91:21 | ...+... | exprs.go:91:15:91:21 | After ...+... |
15681536
| exprs.go:91:15:91:21 | After ...+... | exprs.go:91:24:91:24 | Before 2 |
1569-
| exprs.go:91:15:91:21 | Before ...+... | exprs.go:91:15:91:15 | Before 0 |
1537+
| exprs.go:91:15:91:21 | Before ...+... | exprs.go:91:15:91:21 | ...+... |
15701538
| exprs.go:91:15:91:24 | After key-value pair | exprs.go:91:15:91:24 | lit-init key-value pair |
15711539
| exprs.go:91:15:91:24 | Before key-value pair | exprs.go:91:15:91:21 | Before ...+... |
15721540
| exprs.go:91:15:91:24 | key-value pair | exprs.go:91:15:91:24 | After key-value pair |
15731541
| exprs.go:91:15:91:24 | lit-init key-value pair | exprs.go:91:9:91:25 | After slice literal |
1574-
| exprs.go:91:19:91:21 | After one | exprs.go:91:15:91:21 | ...+... |
1575-
| exprs.go:91:19:91:21 | Before one | exprs.go:91:19:91:21 | one |
1576-
| exprs.go:91:19:91:21 | one | exprs.go:91:19:91:21 | After one |
15771542
| exprs.go:91:24:91:24 | 2 | exprs.go:91:24:91:24 | After 2 |
15781543
| exprs.go:91:24:91:24 | After 2 | exprs.go:91:15:91:24 | key-value pair |
15791544
| exprs.go:91:24:91:24 | Before 2 | exprs.go:91:24:91:24 | 2 |
@@ -2774,21 +2739,9 @@
27742739
| stmts3.go:9:3:9:6 | zero-init:0 value declaration specifier | stmts3.go:9:3:9:6 | After value declaration specifier |
27752740
| stmts3.go:11:2:11:26 | Before return statement | stmts3.go:11:9:11:26 | Before ...-... |
27762741
| stmts3.go:11:2:11:26 | return statement | stmts3.go:5:1:12:1 | Normal Exit |
2777-
| stmts3.go:11:9:11:11 | After red | stmts3.go:11:15:11:19 | Before green |
2778-
| stmts3.go:11:9:11:11 | Before red | stmts3.go:11:9:11:11 | red |
2779-
| stmts3.go:11:9:11:11 | red | stmts3.go:11:9:11:11 | After red |
2780-
| stmts3.go:11:9:11:19 | ...+... | stmts3.go:11:9:11:19 | After ...+... |
2781-
| stmts3.go:11:9:11:19 | After ...+... | stmts3.go:11:23:11:26 | Before blue |
2782-
| stmts3.go:11:9:11:19 | Before ...+... | stmts3.go:11:9:11:11 | Before red |
27832742
| stmts3.go:11:9:11:26 | ...-... | stmts3.go:11:9:11:26 | After ...-... |
27842743
| stmts3.go:11:9:11:26 | After ...-... | stmts3.go:11:2:11:26 | return statement |
2785-
| stmts3.go:11:9:11:26 | Before ...-... | stmts3.go:11:9:11:19 | Before ...+... |
2786-
| stmts3.go:11:15:11:19 | After green | stmts3.go:11:9:11:19 | ...+... |
2787-
| stmts3.go:11:15:11:19 | Before green | stmts3.go:11:15:11:19 | green |
2788-
| stmts3.go:11:15:11:19 | green | stmts3.go:11:15:11:19 | After green |
2789-
| stmts3.go:11:23:11:26 | After blue | stmts3.go:11:9:11:26 | ...-... |
2790-
| stmts3.go:11:23:11:26 | Before blue | stmts3.go:11:23:11:26 | blue |
2791-
| stmts3.go:11:23:11:26 | blue | stmts3.go:11:23:11:26 | After blue |
2744+
| stmts3.go:11:9:11:26 | Before ...-... | stmts3.go:11:9:11:26 | ...-... |
27922745
| stmts3.go:14:1:16:1 | After function declaration | stmts3.go:18:1:20:1 | Before function declaration |
27932746
| stmts3.go:14:1:16:1 | Before function declaration | stmts3.go:14:1:16:1 | function declaration |
27942747
| stmts3.go:14:1:16:1 | Entry | stmts3.go:14:13:14:13 | x |
@@ -3715,17 +3668,11 @@
37153668
| stmts.go:94:2:95:13 | After case clause [match] | stmts.go:95:3:95:13 | expression statement |
37163669
| stmts.go:94:2:95:13 | After case clause [no-match] | stmts.go:90:2:96:2 | After expression-switch statement |
37173670
| stmts.go:94:2:95:13 | case clause | stmts.go:94:7:94:11 | Before ...-... |
3718-
| stmts.go:94:7:94:7 | 2 | stmts.go:94:7:94:7 | After 2 |
3719-
| stmts.go:94:7:94:7 | After 2 | stmts.go:94:11:94:11 | Before 5 |
3720-
| stmts.go:94:7:94:7 | Before 2 | stmts.go:94:7:94:7 | 2 |
37213671
| stmts.go:94:7:94:11 | ...-... | stmts.go:94:7:94:11 | After ...-... [match] |
37223672
| stmts.go:94:7:94:11 | ...-... | stmts.go:94:7:94:11 | After ...-... [no-match] |
37233673
| stmts.go:94:7:94:11 | After ...-... [match] | stmts.go:94:2:95:13 | After case clause [match] |
37243674
| stmts.go:94:7:94:11 | After ...-... [no-match] | stmts.go:94:2:95:13 | After case clause [no-match] |
3725-
| stmts.go:94:7:94:11 | Before ...-... | stmts.go:94:7:94:7 | Before 2 |
3726-
| stmts.go:94:11:94:11 | 5 | stmts.go:94:11:94:11 | After 5 |
3727-
| stmts.go:94:11:94:11 | After 5 | stmts.go:94:7:94:11 | ...-... |
3728-
| stmts.go:94:11:94:11 | Before 5 | stmts.go:94:11:94:11 | 5 |
3675+
| stmts.go:94:7:94:11 | Before ...-... | stmts.go:94:7:94:11 | ...-... |
37293676
| stmts.go:95:3:95:7 | After test5 | stmts.go:95:9:95:12 | Before true |
37303677
| stmts.go:95:3:95:7 | Before test5 | stmts.go:95:3:95:7 | test5 |
37313678
| stmts.go:95:3:95:7 | test5 | stmts.go:95:3:95:7 | After test5 |
@@ -4152,27 +4099,9 @@
41524099
| tst.go:16:7:16:33 | After ...<... [match] | tst.go:16:2:16:34 | After case clause [match] |
41534100
| tst.go:16:7:16:33 | After ...<... [no-match] | tst.go:16:2:16:34 | After case clause [no-match] |
41544101
| tst.go:16:7:16:33 | Before ...<... | tst.go:16:7:16:11 | Before value |
4155-
| tst.go:16:15:16:18 | 1024 | tst.go:16:15:16:18 | After 1024 |
4156-
| tst.go:16:15:16:18 | After 1024 | tst.go:16:20:16:23 | Before 1024 |
4157-
| tst.go:16:15:16:18 | Before 1024 | tst.go:16:15:16:18 | 1024 |
4158-
| tst.go:16:15:16:23 | ...*... | tst.go:16:15:16:23 | After ...*... |
4159-
| tst.go:16:15:16:23 | After ...*... | tst.go:16:25:16:28 | Before 1024 |
4160-
| tst.go:16:15:16:23 | Before ...*... | tst.go:16:15:16:18 | Before 1024 |
4161-
| tst.go:16:15:16:28 | ...*... | tst.go:16:15:16:28 | After ...*... |
4162-
| tst.go:16:15:16:28 | After ...*... | tst.go:16:30:16:33 | Before 1024 |
4163-
| tst.go:16:15:16:28 | Before ...*... | tst.go:16:15:16:23 | Before ...*... |
41644102
| tst.go:16:15:16:33 | ...*... | tst.go:16:15:16:33 | After ...*... |
41654103
| tst.go:16:15:16:33 | After ...*... | tst.go:16:7:16:33 | ...<... |
4166-
| tst.go:16:15:16:33 | Before ...*... | tst.go:16:15:16:28 | Before ...*... |
4167-
| tst.go:16:20:16:23 | 1024 | tst.go:16:20:16:23 | After 1024 |
4168-
| tst.go:16:20:16:23 | After 1024 | tst.go:16:15:16:23 | ...*... |
4169-
| tst.go:16:20:16:23 | Before 1024 | tst.go:16:20:16:23 | 1024 |
4170-
| tst.go:16:25:16:28 | 1024 | tst.go:16:25:16:28 | After 1024 |
4171-
| tst.go:16:25:16:28 | After 1024 | tst.go:16:15:16:28 | ...*... |
4172-
| tst.go:16:25:16:28 | Before 1024 | tst.go:16:25:16:28 | 1024 |
4173-
| tst.go:16:30:16:33 | 1024 | tst.go:16:30:16:33 | After 1024 |
4174-
| tst.go:16:30:16:33 | After 1024 | tst.go:16:15:16:33 | ...*... |
4175-
| tst.go:16:30:16:33 | Before 1024 | tst.go:16:30:16:33 | 1024 |
4104+
| tst.go:16:15:16:33 | Before ...*... | tst.go:16:15:16:33 | ...*... |
41764105
| tst.go:18:2:18:39 | After case clause [match] | tst.go:15:2:20:2 | After expression-switch statement |
41774106
| tst.go:18:2:18:39 | After case clause [no-match] | tst.go:15:2:20:2 | After expression-switch statement |
41784107
| tst.go:18:2:18:39 | case clause | tst.go:18:7:18:38 | Before ...<... |
@@ -4184,33 +4113,9 @@
41844113
| tst.go:18:7:18:38 | After ...<... [match] | tst.go:18:2:18:39 | After case clause [match] |
41854114
| tst.go:18:7:18:38 | After ...<... [no-match] | tst.go:18:2:18:39 | After case clause [no-match] |
41864115
| tst.go:18:7:18:38 | Before ...<... | tst.go:18:7:18:11 | Before value |
4187-
| tst.go:18:15:18:18 | 1024 | tst.go:18:15:18:18 | After 1024 |
4188-
| tst.go:18:15:18:18 | After 1024 | tst.go:18:20:18:23 | Before 1024 |
4189-
| tst.go:18:15:18:18 | Before 1024 | tst.go:18:15:18:18 | 1024 |
4190-
| tst.go:18:15:18:23 | ...*... | tst.go:18:15:18:23 | After ...*... |
4191-
| tst.go:18:15:18:23 | After ...*... | tst.go:18:25:18:28 | Before 1024 |
4192-
| tst.go:18:15:18:23 | Before ...*... | tst.go:18:15:18:18 | Before 1024 |
4193-
| tst.go:18:15:18:28 | ...*... | tst.go:18:15:18:28 | After ...*... |
4194-
| tst.go:18:15:18:28 | After ...*... | tst.go:18:30:18:33 | Before 1024 |
4195-
| tst.go:18:15:18:28 | Before ...*... | tst.go:18:15:18:23 | Before ...*... |
4196-
| tst.go:18:15:18:33 | ...*... | tst.go:18:15:18:33 | After ...*... |
4197-
| tst.go:18:15:18:33 | After ...*... | tst.go:18:35:18:38 | Before 1024 |
4198-
| tst.go:18:15:18:33 | Before ...*... | tst.go:18:15:18:28 | Before ...*... |
41994116
| tst.go:18:15:18:38 | ...*... | tst.go:18:15:18:38 | After ...*... |
42004117
| tst.go:18:15:18:38 | After ...*... | tst.go:18:7:18:38 | ...<... |
4201-
| tst.go:18:15:18:38 | Before ...*... | tst.go:18:15:18:33 | Before ...*... |
4202-
| tst.go:18:20:18:23 | 1024 | tst.go:18:20:18:23 | After 1024 |
4203-
| tst.go:18:20:18:23 | After 1024 | tst.go:18:15:18:23 | ...*... |
4204-
| tst.go:18:20:18:23 | Before 1024 | tst.go:18:20:18:23 | 1024 |
4205-
| tst.go:18:25:18:28 | 1024 | tst.go:18:25:18:28 | After 1024 |
4206-
| tst.go:18:25:18:28 | After 1024 | tst.go:18:15:18:28 | ...*... |
4207-
| tst.go:18:25:18:28 | Before 1024 | tst.go:18:25:18:28 | 1024 |
4208-
| tst.go:18:30:18:33 | 1024 | tst.go:18:30:18:33 | After 1024 |
4209-
| tst.go:18:30:18:33 | After 1024 | tst.go:18:15:18:33 | ...*... |
4210-
| tst.go:18:30:18:33 | Before 1024 | tst.go:18:30:18:33 | 1024 |
4211-
| tst.go:18:35:18:38 | 1024 | tst.go:18:35:18:38 | After 1024 |
4212-
| tst.go:18:35:18:38 | After 1024 | tst.go:18:15:18:38 | ...*... |
4213-
| tst.go:18:35:18:38 | Before 1024 | tst.go:18:35:18:38 | 1024 |
4118+
| tst.go:18:15:18:38 | Before ...*... | tst.go:18:15:18:38 | ...*... |
42144119
| tst.go:23:1:26:1 | After function declaration | tst.go:28:1:32:1 | Before function declaration |
42154120
| tst.go:23:1:26:1 | Before function declaration | tst.go:23:1:26:1 | function declaration |
42164121
| tst.go:23:1:26:1 | Entry | tst.go:23:15:26:1 | block statement |

go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@
3434
| main.go:38:2:38:9 | SSA def(res) | main.go:38:9:38:9 | 9 |
3535
| main.go:38:9:38:9 | 9 | main.go:38:9:38:9 | 9 |
3636
| regressions.go:5:11:5:31 | call to Sizeof | regressions.go:5:11:5:31 | call to Sizeof |
37-
| regressions.go:5:25:5:30 | call to test | regressions.go:5:25:5:30 | call to test |
3837
| regressions.go:7:11:7:15 | false | regressions.go:7:11:7:15 | false |
39-
| regressions.go:9:11:9:12 | After !... | regressions.go:11:11:11:14 | true |
40-
| regressions.go:9:12:9:12 | d | regressions.go:7:11:7:15 | false |
38+
| regressions.go:9:11:9:12 | !... | regressions.go:11:11:11:14 | true |
4139
| regressions.go:11:11:11:14 | true | regressions.go:11:11:11:14 | true |
4240
| regressions.go:30:9:30:22 | call to getPayload | regressions.go:30:9:30:22 | call to getPayload |
4341
| regressions.go:30:26:30:39 | call to getPayload | regressions.go:30:26:30:39 | call to getPayload |

0 commit comments

Comments
 (0)