Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f5d5488

Browse filesBrowse files
authored
Merge pull request #16044 from ethereum/fix_ssacfg_literal_handling
assign zero value to not explicitly initialized variables during ssa cfg construction
2 parents 9396227 + e0daa3c commit f5d5488
Copy full SHA for f5d5488

File tree

2 files changed

+42
-5
lines changed
Filter options

2 files changed

+42
-5
lines changed

‎libyul/backends/evm/SSAControlFlowGraphBuilder.cpp

Copy file name to clipboardExpand all lines: libyul/backends/evm/SSAControlFlowGraphBuilder.cpp
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,6 @@ void SSAControlFlowGraphBuilder::operator()(Assignment const& _assignment)
273273

274274
void SSAControlFlowGraphBuilder::operator()(VariableDeclaration const& _variableDeclaration)
275275
{
276-
// if we have no value (like in `let a` without right-hand side), we can just skip this. the variable(s) will be
277-
// added when first needed
278-
if (!_variableDeclaration.value)
279-
return;
280-
281276
assign(
282277
_variableDeclaration.variables | ranges::views::transform([&](auto& _var) { return std::ref(lookupVariable(_var.name)); }) | ranges::to<std::vector>,
283278
_variableDeclaration.value.get()
+42Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
let x
3+
if mload(42) {
4+
x := 5
5+
}
6+
sstore(x, x)
7+
}
8+
// ----
9+
// digraph SSACFG {
10+
// nodesep=0.7;
11+
// graph[fontname="DejaVu Sans"]
12+
// node[shape=box,fontname="DejaVu Sans"];
13+
//
14+
// Entry0 [label="Entry"];
15+
// Entry0 -> Block0_0;
16+
// Block0_0 [label="\
17+
// Block 0; (0, max 2)\nLiveIn: \l\
18+
// LiveOut: v1\l\nv1 := 0\l\
19+
// v3 := mload(42)\l\
20+
// "];
21+
// Block0_0 -> Block0_0Exit;
22+
// Block0_0Exit [label="{ If v3 | { <0> Zero | <1> NonZero }}" shape=Mrecord];
23+
// Block0_0Exit:0 -> Block0_2 [style="solid"];
24+
// Block0_0Exit:1 -> Block0_1 [style="solid"];
25+
// Block0_1 [label="\
26+
// Block 1; (1, max 2)\nLiveIn: \l\
27+
// LiveOut: v5\l\nv5 := 5\l\
28+
// "];
29+
// Block0_1 -> Block0_1Exit [arrowhead=none];
30+
// Block0_1Exit [label="Jump" shape=oval];
31+
// Block0_1Exit -> Block0_2 [style="solid"];
32+
// Block0_2 [label="\
33+
// Block 2; (2, max 2)\nLiveIn: v6\l\
34+
// LiveOut: \l\nv6 := φ(\l\
35+
// Block 0 => v1,\l\
36+
// Block 1 => v5\l\
37+
// )\l\
38+
// sstore(v6, v6)\l\
39+
// "];
40+
// Block0_2Exit [label="MainExit"];
41+
// Block0_2 -> Block0_2Exit;
42+
// }

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.