-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate stack height at branch instructions #386
Conversation
Codecov Report
@@ Coverage Diff @@
## master #386 +/- ##
==========================================
+ Coverage 99.32% 99.33% +0.01%
==========================================
Files 42 42
Lines 12489 12688 +199
==========================================
+ Hits 12405 12604 +199
Misses 84 84 |
b5d528e
to
a5b0de0
Compare
lib/fizzy/parser_expr.cpp
Outdated
inline void validate_branch_stack_height( | ||
const ControlFrame& current_frame, const ControlFrame& branch_frame) | ||
{ | ||
// assert(current_frame.stack_height >= current_frame.parent_stack_height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be enabled after #384 is merged
lib/fizzy/parser_expr.cpp
Outdated
{ | ||
// assert(current_frame.stack_height >= current_frame.parent_stack_height); | ||
|
||
if (!current_frame.unreachable && get_branch_arity(branch_frame) == 1 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be expressed without assuming branch_airty ∈{0,1}
. E.g. like
current_frame.stack_height - get_branch_arity(branch_frame) < current_frame.parent_stack_height
Just make sure this uses signed integer types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice suggestion, I changed it to be similar to checks in validate_result_count
No description provided.