Skip to content

Commit d220d5c

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 ebd83dc commit d220d5c

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
@@ -33,6 +33,21 @@ module GoCfg {
3333
Input::implicitFieldSelection(e, index, implicitField)
3434
}
3535

36+
/**
37+
* Holds if `root` is a constant root: a constant expression (with any
38+
* enclosing parentheses stripped) whose parent expression is not itself
39+
* constant. The strict sub-expressions of a constant root are folded at
40+
* compile time and are not evaluated at run time, so they get no evaluation
41+
* node; the constant root itself is evaluated as a single leaf value.
42+
*/
43+
private predicate constRoot(Go::Expr root) {
44+
exists(Go::Expr c |
45+
c.isConst() and
46+
not c.getParent().(Go::Expr).isConst() and
47+
root = c.stripParens()
48+
)
49+
}
50+
3651
/** Provides an implementation of the AST signature for Go. */
3752
private module Ast implements CfgLib::AstSig<Go::Location> {
3853
class AstNode = Go::AstNode;
@@ -81,6 +96,10 @@ module GoCfg {
8196
// the switch expression (see `Switch.getExpr`), so the wrapping
8297
// statement must not introduce its own assignment or expression nodes.
8398
e = any(Go::TypeSwitchStmt ts).getTest()
99+
or
100+
// The strict sub-expressions of a constant expression are not evaluated
101+
// at run time, so they must not get their own evaluation nodes.
102+
constRoot(e.(Go::Expr).getParent+())
84103
}
85104

86105
AstNode getChild(AstNode n, int index) {
@@ -346,17 +365,29 @@ module GoCfg {
346365

347366
class BinaryExpr = Go::BinaryExpr;
348367

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

351-
class LogicalOrExpr = Go::LorExpr;
378+
class LogicalOrExpr extends Go::LorExpr {
379+
LogicalOrExpr() { not this.isConst() }
380+
}
352381

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

357386
class UnaryExpr = Go::UnaryExpr;
358387

359-
class LogicalNotExpr = Go::NotExpr;
388+
class LogicalNotExpr extends Go::NotExpr {
389+
LogicalNotExpr() { not this.isConst() }
390+
}
360391

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

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,16 @@ module IR {
222222
// `defer-invoke` node that models the call at function exit.
223223
this.isAdditional(e, "defer-invoke")
224224
or
225-
// `NotExpr` and `LogicalBinaryExpr` are not in `postOrInOrder`, so they
226-
// don't have an `isIn` node. Only use the after-node when the
227-
// expression is not in a conditional context; otherwise the value is
228-
// split across `TAfterValueNode`s per branch and should not be exposed
229-
// as a single value-producing instruction.
225+
// Non-constant `NotExpr` and `LogicalBinaryExpr` are not in
226+
// `postOrInOrder`, so they don't have an `isIn` node; their value is
227+
// produced by the after-node. (Constant ones are folded and get a leaf
228+
// `isIn` node via `constRoot`, handled by the first disjunct above, so
229+
// they are excluded here to avoid a duplicate value node.) Only use the
230+
// after-node when the expression is not in a conditional context;
231+
// otherwise the value is split across `TAfterValueNode`s per branch and
232+
// should not be exposed as a single value-producing instruction.
230233
(e instanceof NotExpr or e instanceof LogicalBinaryExpr) and
234+
not e.isConst() and
231235
not isInBooleanCondContext(e) and
232236
this.isAfter(e)
233237
}

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
@@ -553,10 +553,7 @@
553553
| epilogues.go:90:4:90:14 | assign:0 ... = ... | epilogues.go:90:4:90:14 | After ... = ... |
554554
| epilogues.go:90:13:90:14 | -... | epilogues.go:90:13:90:14 | After -... |
555555
| epilogues.go:90:13:90:14 | After -... | epilogues.go:90:4:90:14 | assign:0 ... = ... |
556-
| epilogues.go:90:13:90:14 | Before -... | epilogues.go:90:14:90:14 | Before 1 |
557-
| epilogues.go:90:14:90:14 | 1 | epilogues.go:90:14:90:14 | After 1 |
558-
| epilogues.go:90:14:90:14 | After 1 | epilogues.go:90:13:90:14 | -... |
559-
| epilogues.go:90:14:90:14 | Before 1 | epilogues.go:90:14:90:14 | 1 |
556+
| epilogues.go:90:13:90:14 | Before -... | epilogues.go:90:13:90:14 | -... |
560557
| epilogues.go:93:2:95:2 | After if statement | epilogues.go:96:2:96:15 | ... = ... |
561558
| epilogues.go:93:2:95:2 | if statement | epilogues.go:93:5:93:9 | Before ...<... |
562559
| epilogues.go:93:5:93:5 | After x | epilogues.go:93:9:93:9 | Before 0 |
@@ -809,23 +806,9 @@
809806
| exprs.go:6:13:6:13 | 0 | exprs.go:6:13:6:13 | After 0 |
810807
| exprs.go:6:13:6:13 | After 0 | exprs.go:6:16:6:26 | Before ...+... |
811808
| exprs.go:6:13:6:13 | Before 0 | exprs.go:6:13:6:13 | 0 |
812-
| exprs.go:6:16:6:16 | 1 | exprs.go:6:16:6:16 | After 1 |
813-
| exprs.go:6:16:6:16 | After 1 | exprs.go:6:20:6:26 | (...) |
814-
| exprs.go:6:16:6:16 | Before 1 | exprs.go:6:16:6:16 | 1 |
815809
| exprs.go:6:16:6:26 | ...+... | exprs.go:6:16:6:26 | After ...+... |
816810
| exprs.go:6:16:6:26 | After ...+... | exprs.go:6:6:6:26 | assign:0 value declaration specifier |
817-
| exprs.go:6:16:6:26 | Before ...+... | exprs.go:6:16:6:16 | Before 1 |
818-
| exprs.go:6:20:6:26 | (...) | exprs.go:6:21:6:25 | Before ...+... |
819-
| exprs.go:6:20:6:26 | After (...) | exprs.go:6:16:6:26 | ...+... |
820-
| exprs.go:6:21:6:21 | 2 | exprs.go:6:21:6:21 | After 2 |
821-
| exprs.go:6:21:6:21 | After 2 | exprs.go:6:25:6:25 | Before 3 |
822-
| exprs.go:6:21:6:21 | Before 2 | exprs.go:6:21:6:21 | 2 |
823-
| exprs.go:6:21:6:25 | ...+... | exprs.go:6:21:6:25 | After ...+... |
824-
| exprs.go:6:21:6:25 | After ...+... | exprs.go:6:20:6:26 | After (...) |
825-
| exprs.go:6:21:6:25 | Before ...+... | exprs.go:6:21:6:21 | Before 2 |
826-
| exprs.go:6:25:6:25 | 3 | exprs.go:6:25:6:25 | After 3 |
827-
| exprs.go:6:25:6:25 | After 3 | exprs.go:6:21:6:25 | ...+... |
828-
| exprs.go:6:25:6:25 | Before 3 | exprs.go:6:25:6:25 | 3 |
811+
| exprs.go:6:16:6:26 | Before ...+... | exprs.go:6:16:6:26 | ...+... |
829812
| exprs.go:7:2:7:16 | After declaration statement | exprs.go:8:2:8:24 | ... := ... |
830813
| exprs.go:7:2:7:16 | After variable declaration | exprs.go:7:2:7:16 | After declaration statement |
831814
| exprs.go:7:2:7:16 | declaration statement | exprs.go:7:2:7:16 | variable declaration |
@@ -925,15 +908,9 @@
925908
| exprs.go:14:13:14:13 | After j | exprs.go:14:16:14:19 | Before .../... |
926909
| exprs.go:14:13:14:13 | Before j | exprs.go:14:13:14:13 | j |
927910
| exprs.go:14:13:14:13 | j | exprs.go:14:13:14:13 | After j |
928-
| exprs.go:14:16:14:16 | 3 | exprs.go:14:16:14:16 | After 3 |
929-
| exprs.go:14:16:14:16 | After 3 | exprs.go:14:18:14:19 | Before 14 |
930-
| exprs.go:14:16:14:16 | Before 3 | exprs.go:14:16:14:16 | 3 |
931911
| exprs.go:14:16:14:19 | .../... | exprs.go:14:16:14:19 | After .../... |
932912
| exprs.go:14:16:14:19 | After .../... | exprs.go:14:7:14:20 | call to fn |
933-
| exprs.go:14:16:14:19 | Before .../... | exprs.go:14:16:14:16 | Before 3 |
934-
| exprs.go:14:18:14:19 | 14 | exprs.go:14:18:14:19 | After 14 |
935-
| exprs.go:14:18:14:19 | After 14 | exprs.go:14:16:14:19 | .../... |
936-
| exprs.go:14:18:14:19 | Before 14 | exprs.go:14:18:14:19 | 14 |
913+
| exprs.go:14:16:14:19 | Before .../... | exprs.go:14:16:14:19 | .../... |
937914
| exprs.go:15:2:15:58 | ... := ... | exprs.go:15:13:15:58 | Before struct literal |
938915
| exprs.go:15:2:15:58 | After ... := ... | exprs.go:16:2:16:26 | ... := ... |
939916
| exprs.go:15:2:15:58 | assign:0 ... := ... | exprs.go:15:2:15:58 | After ... := ... |
@@ -1209,10 +1186,7 @@
12091186
| exprs.go:36:2:36:10 | return statement | exprs.go:32:1:37:1 | Normal Exit |
12101187
| exprs.go:36:9:36:10 | -... | exprs.go:36:9:36:10 | After -... |
12111188
| exprs.go:36:9:36:10 | After -... | exprs.go:36:2:36:10 | return statement |
1212-
| exprs.go:36:9:36:10 | Before -... | exprs.go:36:10:36:10 | Before 1 |
1213-
| exprs.go:36:10:36:10 | 1 | exprs.go:36:10:36:10 | After 1 |
1214-
| exprs.go:36:10:36:10 | After 1 | exprs.go:36:9:36:10 | -... |
1215-
| exprs.go:36:10:36:10 | Before 1 | exprs.go:36:10:36:10 | 1 |
1189+
| exprs.go:36:9:36:10 | Before -... | exprs.go:36:9:36:10 | -... |
12161190
| exprs.go:39:1:47:1 | After function declaration | exprs.go:49:1:54:1 | Before function declaration |
12171191
| exprs.go:39:1:47:1 | Before function declaration | exprs.go:39:1:47:1 | function declaration |
12181192
| exprs.go:39:1:47:1 | Entry | exprs.go:39:33:47:1 | block statement |
@@ -1264,10 +1238,7 @@
12641238
| exprs.go:46:2:46:10 | return statement | exprs.go:39:1:47:1 | Normal Exit |
12651239
| exprs.go:46:9:46:10 | -... | exprs.go:46:9:46:10 | After -... |
12661240
| exprs.go:46:9:46:10 | After -... | exprs.go:46:2:46:10 | return statement |
1267-
| exprs.go:46:9:46:10 | Before -... | exprs.go:46:10:46:10 | Before 1 |
1268-
| exprs.go:46:10:46:10 | 1 | exprs.go:46:10:46:10 | After 1 |
1269-
| exprs.go:46:10:46:10 | After 1 | exprs.go:46:9:46:10 | -... |
1270-
| exprs.go:46:10:46:10 | Before 1 | exprs.go:46:10:46:10 | 1 |
1241+
| exprs.go:46:9:46:10 | Before -... | exprs.go:46:9:46:10 | -... |
12711242
| exprs.go:49:1:54:1 | After function declaration | exprs.go:56:1:58:1 | Before function declaration |
12721243
| exprs.go:49:1:54:1 | Before function declaration | exprs.go:49:1:54:1 | function declaration |
12731244
| exprs.go:49:1:54:1 | Entry | exprs.go:49:30:54:1 | block statement |
@@ -1556,19 +1527,13 @@
15561527
| exprs.go:91:9:91:25 | After slice literal | exprs.go:91:5:91:25 | assign:0 value declaration specifier |
15571528
| exprs.go:91:9:91:25 | Before slice literal | exprs.go:91:9:91:25 | slice literal |
15581529
| exprs.go:91:9:91:25 | slice literal | exprs.go:91:15:91:24 | Before key-value pair |
1559-
| exprs.go:91:15:91:15 | 0 | exprs.go:91:15:91:15 | After 0 |
1560-
| exprs.go:91:15:91:15 | After 0 | exprs.go:91:19:91:21 | Before one |
1561-
| exprs.go:91:15:91:15 | Before 0 | exprs.go:91:15:91:15 | 0 |
15621530
| exprs.go:91:15:91:21 | ...+... | exprs.go:91:15:91:21 | After ...+... |
15631531
| exprs.go:91:15:91:21 | After ...+... | exprs.go:91:24:91:24 | Before 2 |
1564-
| exprs.go:91:15:91:21 | Before ...+... | exprs.go:91:15:91:15 | Before 0 |
1532+
| exprs.go:91:15:91:21 | Before ...+... | exprs.go:91:15:91:21 | ...+... |
15651533
| exprs.go:91:15:91:24 | After key-value pair | exprs.go:91:15:91:24 | lit-init key-value pair |
15661534
| exprs.go:91:15:91:24 | Before key-value pair | exprs.go:91:15:91:21 | Before ...+... |
15671535
| exprs.go:91:15:91:24 | key-value pair | exprs.go:91:15:91:24 | After key-value pair |
15681536
| exprs.go:91:15:91:24 | lit-init key-value pair | exprs.go:91:9:91:25 | After slice literal |
1569-
| exprs.go:91:19:91:21 | After one | exprs.go:91:15:91:21 | ...+... |
1570-
| exprs.go:91:19:91:21 | Before one | exprs.go:91:19:91:21 | one |
1571-
| exprs.go:91:19:91:21 | one | exprs.go:91:19:91:21 | After one |
15721537
| exprs.go:91:24:91:24 | 2 | exprs.go:91:24:91:24 | After 2 |
15731538
| exprs.go:91:24:91:24 | After 2 | exprs.go:91:15:91:24 | key-value pair |
15741539
| exprs.go:91:24:91:24 | Before 2 | exprs.go:91:24:91:24 | 2 |
@@ -2769,21 +2734,9 @@
27692734
| stmts3.go:9:3:9:6 | zero-init:0 value declaration specifier | stmts3.go:9:3:9:6 | After value declaration specifier |
27702735
| stmts3.go:11:2:11:26 | Before return statement | stmts3.go:11:9:11:26 | Before ...-... |
27712736
| stmts3.go:11:2:11:26 | return statement | stmts3.go:5:1:12:1 | Normal Exit |
2772-
| stmts3.go:11:9:11:11 | After red | stmts3.go:11:15:11:19 | Before green |
2773-
| stmts3.go:11:9:11:11 | Before red | stmts3.go:11:9:11:11 | red |
2774-
| stmts3.go:11:9:11:11 | red | stmts3.go:11:9:11:11 | After red |
2775-
| stmts3.go:11:9:11:19 | ...+... | stmts3.go:11:9:11:19 | After ...+... |
2776-
| stmts3.go:11:9:11:19 | After ...+... | stmts3.go:11:23:11:26 | Before blue |
2777-
| stmts3.go:11:9:11:19 | Before ...+... | stmts3.go:11:9:11:11 | Before red |
27782737
| stmts3.go:11:9:11:26 | ...-... | stmts3.go:11:9:11:26 | After ...-... |
27792738
| stmts3.go:11:9:11:26 | After ...-... | stmts3.go:11:2:11:26 | return statement |
2780-
| stmts3.go:11:9:11:26 | Before ...-... | stmts3.go:11:9:11:19 | Before ...+... |
2781-
| stmts3.go:11:15:11:19 | After green | stmts3.go:11:9:11:19 | ...+... |
2782-
| stmts3.go:11:15:11:19 | Before green | stmts3.go:11:15:11:19 | green |
2783-
| stmts3.go:11:15:11:19 | green | stmts3.go:11:15:11:19 | After green |
2784-
| stmts3.go:11:23:11:26 | After blue | stmts3.go:11:9:11:26 | ...-... |
2785-
| stmts3.go:11:23:11:26 | Before blue | stmts3.go:11:23:11:26 | blue |
2786-
| stmts3.go:11:23:11:26 | blue | stmts3.go:11:23:11:26 | After blue |
2739+
| stmts3.go:11:9:11:26 | Before ...-... | stmts3.go:11:9:11:26 | ...-... |
27872740
| stmts3.go:14:1:16:1 | After function declaration | stmts3.go:18:1:20:1 | Before function declaration |
27882741
| stmts3.go:14:1:16:1 | Before function declaration | stmts3.go:14:1:16:1 | function declaration |
27892742
| stmts3.go:14:1:16:1 | Entry | stmts3.go:14:21:16:1 | block statement |
@@ -3574,17 +3527,11 @@
35743527
| stmts.go:94:2:95:13 | After case clause [match] | stmts.go:95:3:95:13 | expression statement |
35753528
| stmts.go:94:2:95:13 | After case clause [no-match] | stmts.go:90:2:96:2 | After expression-switch statement |
35763529
| stmts.go:94:2:95:13 | case clause | stmts.go:94:7:94:11 | Before ...-... |
3577-
| stmts.go:94:7:94:7 | 2 | stmts.go:94:7:94:7 | After 2 |
3578-
| stmts.go:94:7:94:7 | After 2 | stmts.go:94:11:94:11 | Before 5 |
3579-
| stmts.go:94:7:94:7 | Before 2 | stmts.go:94:7:94:7 | 2 |
35803530
| stmts.go:94:7:94:11 | ...-... | stmts.go:94:7:94:11 | After ...-... [match] |
35813531
| stmts.go:94:7:94:11 | ...-... | stmts.go:94:7:94:11 | After ...-... [no-match] |
35823532
| stmts.go:94:7:94:11 | After ...-... [match] | stmts.go:94:2:95:13 | After case clause [match] |
35833533
| stmts.go:94:7:94:11 | After ...-... [no-match] | stmts.go:94:2:95:13 | After case clause [no-match] |
3584-
| stmts.go:94:7:94:11 | Before ...-... | stmts.go:94:7:94:7 | Before 2 |
3585-
| stmts.go:94:11:94:11 | 5 | stmts.go:94:11:94:11 | After 5 |
3586-
| stmts.go:94:11:94:11 | After 5 | stmts.go:94:7:94:11 | ...-... |
3587-
| stmts.go:94:11:94:11 | Before 5 | stmts.go:94:11:94:11 | 5 |
3534+
| stmts.go:94:7:94:11 | Before ...-... | stmts.go:94:7:94:11 | ...-... |
35883535
| stmts.go:95:3:95:7 | After test5 | stmts.go:95:9:95:12 | Before true |
35893536
| stmts.go:95:3:95:7 | Before test5 | stmts.go:95:3:95:7 | test5 |
35903537
| stmts.go:95:3:95:7 | test5 | stmts.go:95:3:95:7 | After test5 |
@@ -4011,27 +3958,9 @@
40113958
| tst.go:16:7:16:33 | After ...<... [match] | tst.go:16:2:16:34 | After case clause [match] |
40123959
| tst.go:16:7:16:33 | After ...<... [no-match] | tst.go:16:2:16:34 | After case clause [no-match] |
40133960
| tst.go:16:7:16:33 | Before ...<... | tst.go:16:7:16:11 | Before value |
4014-
| tst.go:16:15:16:18 | 1024 | tst.go:16:15:16:18 | After 1024 |
4015-
| tst.go:16:15:16:18 | After 1024 | tst.go:16:20:16:23 | Before 1024 |
4016-
| tst.go:16:15:16:18 | Before 1024 | tst.go:16:15:16:18 | 1024 |
4017-
| tst.go:16:15:16:23 | ...*... | tst.go:16:15:16:23 | After ...*... |
4018-
| tst.go:16:15:16:23 | After ...*... | tst.go:16:25:16:28 | Before 1024 |
4019-
| tst.go:16:15:16:23 | Before ...*... | tst.go:16:15:16:18 | Before 1024 |
4020-
| tst.go:16:15:16:28 | ...*... | tst.go:16:15:16:28 | After ...*... |
4021-
| tst.go:16:15:16:28 | After ...*... | tst.go:16:30:16:33 | Before 1024 |
4022-
| tst.go:16:15:16:28 | Before ...*... | tst.go:16:15:16:23 | Before ...*... |
40233961
| tst.go:16:15:16:33 | ...*... | tst.go:16:15:16:33 | After ...*... |
40243962
| tst.go:16:15:16:33 | After ...*... | tst.go:16:7:16:33 | ...<... |
4025-
| tst.go:16:15:16:33 | Before ...*... | tst.go:16:15:16:28 | Before ...*... |
4026-
| tst.go:16:20:16:23 | 1024 | tst.go:16:20:16:23 | After 1024 |
4027-
| tst.go:16:20:16:23 | After 1024 | tst.go:16:15:16:23 | ...*... |
4028-
| tst.go:16:20:16:23 | Before 1024 | tst.go:16:20:16:23 | 1024 |
4029-
| tst.go:16:25:16:28 | 1024 | tst.go:16:25:16:28 | After 1024 |
4030-
| tst.go:16:25:16:28 | After 1024 | tst.go:16:15:16:28 | ...*... |
4031-
| tst.go:16:25:16:28 | Before 1024 | tst.go:16:25:16:28 | 1024 |
4032-
| tst.go:16:30:16:33 | 1024 | tst.go:16:30:16:33 | After 1024 |
4033-
| tst.go:16:30:16:33 | After 1024 | tst.go:16:15:16:33 | ...*... |
4034-
| tst.go:16:30:16:33 | Before 1024 | tst.go:16:30:16:33 | 1024 |
3963+
| tst.go:16:15:16:33 | Before ...*... | tst.go:16:15:16:33 | ...*... |
40353964
| tst.go:18:2:18:39 | After case clause [match] | tst.go:15:2:20:2 | After expression-switch statement |
40363965
| tst.go:18:2:18:39 | After case clause [no-match] | tst.go:15:2:20:2 | After expression-switch statement |
40373966
| tst.go:18:2:18:39 | case clause | tst.go:18:7:18:38 | Before ...<... |
@@ -4043,33 +3972,9 @@
40433972
| tst.go:18:7:18:38 | After ...<... [match] | tst.go:18:2:18:39 | After case clause [match] |
40443973
| tst.go:18:7:18:38 | After ...<... [no-match] | tst.go:18:2:18:39 | After case clause [no-match] |
40453974
| tst.go:18:7:18:38 | Before ...<... | tst.go:18:7:18:11 | Before value |
4046-
| tst.go:18:15:18:18 | 1024 | tst.go:18:15:18:18 | After 1024 |
4047-
| tst.go:18:15:18:18 | After 1024 | tst.go:18:20:18:23 | Before 1024 |
4048-
| tst.go:18:15:18:18 | Before 1024 | tst.go:18:15:18:18 | 1024 |
4049-
| tst.go:18:15:18:23 | ...*... | tst.go:18:15:18:23 | After ...*... |
4050-
| tst.go:18:15:18:23 | After ...*... | tst.go:18:25:18:28 | Before 1024 |
4051-
| tst.go:18:15:18:23 | Before ...*... | tst.go:18:15:18:18 | Before 1024 |
4052-
| tst.go:18:15:18:28 | ...*... | tst.go:18:15:18:28 | After ...*... |
4053-
| tst.go:18:15:18:28 | After ...*... | tst.go:18:30:18:33 | Before 1024 |
4054-
| tst.go:18:15:18:28 | Before ...*... | tst.go:18:15:18:23 | Before ...*... |
4055-
| tst.go:18:15:18:33 | ...*... | tst.go:18:15:18:33 | After ...*... |
4056-
| tst.go:18:15:18:33 | After ...*... | tst.go:18:35:18:38 | Before 1024 |
4057-
| tst.go:18:15:18:33 | Before ...*... | tst.go:18:15:18:28 | Before ...*... |
40583975
| tst.go:18:15:18:38 | ...*... | tst.go:18:15:18:38 | After ...*... |
40593976
| tst.go:18:15:18:38 | After ...*... | tst.go:18:7:18:38 | ...<... |
4060-
| tst.go:18:15:18:38 | Before ...*... | tst.go:18:15:18:33 | Before ...*... |
4061-
| tst.go:18:20:18:23 | 1024 | tst.go:18:20:18:23 | After 1024 |
4062-
| tst.go:18:20:18:23 | After 1024 | tst.go:18:15:18:23 | ...*... |
4063-
| tst.go:18:20:18:23 | Before 1024 | tst.go:18:20:18:23 | 1024 |
4064-
| tst.go:18:25:18:28 | 1024 | tst.go:18:25:18:28 | After 1024 |
4065-
| tst.go:18:25:18:28 | After 1024 | tst.go:18:15:18:28 | ...*... |
4066-
| tst.go:18:25:18:28 | Before 1024 | tst.go:18:25:18:28 | 1024 |
4067-
| tst.go:18:30:18:33 | 1024 | tst.go:18:30:18:33 | After 1024 |
4068-
| tst.go:18:30:18:33 | After 1024 | tst.go:18:15:18:33 | ...*... |
4069-
| tst.go:18:30:18:33 | Before 1024 | tst.go:18:30:18:33 | 1024 |
4070-
| tst.go:18:35:18:38 | 1024 | tst.go:18:35:18:38 | After 1024 |
4071-
| tst.go:18:35:18:38 | After 1024 | tst.go:18:15:18:38 | ...*... |
4072-
| tst.go:18:35:18:38 | Before 1024 | tst.go:18:35:18:38 | 1024 |
3977+
| tst.go:18:15:18:38 | Before ...*... | tst.go:18:15:18:38 | ...*... |
40733978
| tst.go:23:1:26:1 | After function declaration | tst.go:28:1:32:1 | Before function declaration |
40743979
| tst.go:23:1:26:1 | Before function declaration | tst.go:23:1:26:1 | function declaration |
40753980
| 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)