summaryrefslogtreecommitdiffhomepage
path: root/test/t/codegen.rb
diff options
context:
space:
mode:
authorBouke van der Bijl <[email protected]>2016-12-02 09:48:28 -0500
committerBouke van der Bijl <[email protected]>2016-12-07 15:14:17 -0500
commitd56a19cbf526190de036130fe3a5bf14a0705ee2 (patch)
tree9ab3653a11fb44464c407a53dcd7fda807cff588 /test/t/codegen.rb
parent5930a6ebc7a5ebf0c9b2dfe1d250935e6ddaeceb (diff)
downloadmruby-d56a19cbf526190de036130fe3a5bf14a0705ee2.tar.gz
mruby-d56a19cbf526190de036130fe3a5bf14a0705ee2.zip
Don't generate code for NODE_NEGATE if the result isn't used
Reported by https://hackerone.com/haquaman
Diffstat (limited to 'test/t/codegen.rb')
-rw-r--r--test/t/codegen.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/t/codegen.rb b/test/t/codegen.rb
index bb0f5c306..bd360dbcb 100644
--- a/test/t/codegen.rb
+++ b/test/t/codegen.rb
@@ -63,3 +63,13 @@ assert('splat in case splat') do
assert_equal [1], a
end
+
+assert('negate literal register alignment') do
+ a = *case
+ when 0
+ -0.0
+ 2
+ end
+
+ assert_equal [2], a
+end