summaryrefslogtreecommitdiffhomepage
path: root/test/t/codegen.rb
diff options
context:
space:
mode:
authorFrancis Bogsanyi <[email protected]>2016-11-17 12:59:27 -0500
committerBouke van der Bijl <[email protected]>2016-11-24 10:32:34 -0500
commit964427f82c5a8556daf4448b47cc65fb6d2a94b8 (patch)
treed6f3ce9ecaf598b76a70e80e58e5af348a9f51ef /test/t/codegen.rb
parenta630c4f413f6af764e68210430e8b61a435d38d7 (diff)
downloadmruby-964427f82c5a8556daf4448b47cc65fb6d2a94b8.tar.gz
mruby-964427f82c5a8556daf4448b47cc65fb6d2a94b8.zip
Fix unsafe peephole optimization
Reported by https://hackerone.com/dkasak
Diffstat (limited to 'test/t/codegen.rb')
-rw-r--r--test/t/codegen.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/t/codegen.rb b/test/t/codegen.rb
new file mode 100644
index 000000000..f910d37fb
--- /dev/null
+++ b/test/t/codegen.rb
@@ -0,0 +1,11 @@
+##
+# Codegen tests
+
+assert('peephole optimization does not eliminate move whose result is reused') do
+ assert_raise LocalJumpError do
+ def method
+ yield
+ end
+ method(&a &&= 0)
+ end
+end