Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
d56a19cb
Unverified
Commit
d56a19cb
authored
Dec 02, 2016
by
Bouke van der Bijl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't generate code for NODE_NEGATE if the result isn't used
Reported by
https://hackerone.com/haquaman
parent
5930a6eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+4
-0
test/t/codegen.rb
test/t/codegen.rb
+10
-0
No files found.
mrbgems/mruby-compiler/core/codegen.c
View file @
d56a19cb
...
@@ -2223,6 +2223,10 @@ codegen(codegen_scope *s, node *tree, int val)
...
@@ -2223,6 +2223,10 @@ codegen(codegen_scope *s, node *tree, int val)
{
{
nt
=
(
intptr_t
)
tree
->
car
;
nt
=
(
intptr_t
)
tree
->
car
;
tree
=
tree
->
cdr
;
tree
=
tree
->
cdr
;
if
(
!
val
)
{
codegen
(
s
,
tree
,
NOVAL
);
break
;
}
switch
(
nt
)
{
switch
(
nt
)
{
case
NODE_FLOAT
:
case
NODE_FLOAT
:
{
{
...
...
test/t/codegen.rb
View file @
d56a19cb
...
@@ -63,3 +63,13 @@ assert('splat in case splat') do
...
@@ -63,3 +63,13 @@ assert('splat in case splat') do
assert_equal [1], a
assert_equal [1], a
end
end
assert('negate literal register alignment') do
a = *case
when 0
-0.0
2
end
assert_equal [2], a
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment