aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-16 23:29:20 +0800
committerchriseth <chris@ethereum.org>2018-10-16 23:29:20 +0800
commita435a14e135a4e31ce3cd2bacd32544b2b342074 (patch)
treecefd1c154fede07c3b0c6dc0307d7d271de1f20d /test
parente2e4a9fe81656724111c444cbf253d39bbb2b67b (diff)
downloaddexon-solidity-a435a14e135a4e31ce3cd2bacd32544b2b342074.tar.gz
dexon-solidity-a435a14e135a4e31ce3cd2bacd32544b2b342074.tar.zst
dexon-solidity-a435a14e135a4e31ce3cd2bacd32544b2b342074.zip
Test for crash via inlining.
Diffstat (limited to 'test')
-rw-r--r--test/libyul/yulOptimizerTests/fullInliner/multi_fun_callback.yul84
1 files changed, 84 insertions, 0 deletions
diff --git a/test/libyul/yulOptimizerTests/fullInliner/multi_fun_callback.yul b/test/libyul/yulOptimizerTests/fullInliner/multi_fun_callback.yul
new file mode 100644
index 00000000..7588094f
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullInliner/multi_fun_callback.yul
@@ -0,0 +1,84 @@
+{
+ // This is a test for an older version where
+ // inlining was performed on a function
+ // just being called. This is a problem
+ // because the statemenst of the original
+ // function might be in an invalid state.
+
+ function f(x) {
+ mstore(0, x)
+ mstore(7, h())
+ g(10)
+ mstore(1, x)
+ }
+ function g(x) {
+ f(1)
+ }
+ function h() -> t {
+ t := 2
+
+ }
+ {
+ f(100)
+ }
+}
+// ----
+// fullInliner
+// {
+// {
+// {
+// let f_x_1 := 100
+// mstore(0, f_x_1)
+// let f_h_t
+// f_h_t := 2
+// mstore(7, f_h_t)
+// let f__5 := 10
+// let f_g_x_1 := f__5
+// let f_g_f_x := 1
+// let
+// mstore()
+// let f_g_f_ := h()
+// let
+// mstore()
+// let
+// g(f__5)
+// mstore(1, f_g_f_x)
+// mstore(1, f_x_1)
+// }
+// }
+// function f(x)
+// {
+// mstore(0, x)
+// let h_t
+// h_t := 2
+// mstore(7, h_t)
+// let _5 := 10
+// let g_x_1 := _5
+// let g_f_x := 1
+// let
+// mstore()
+// let g_f_ := h()
+// let
+// mstore()
+// let
+// g(_5)
+// mstore(1, g_f_x)
+// mstore(1, x)
+// }
+// function g(x_1)
+// {
+// let f_x := 1
+// let
+// mstore()
+// let f_ := h()
+// let
+// mstore()
+// let
+// g(_5)
+// mstore(1, f_x)
+// }
+// function h() -> t
+// {
+// t := 2
+// }
+// }