-
Notifications
You must be signed in to change notification settings - Fork 273
Move promotion rule application to C front-end [blocks: #3725, #3800] #3770
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
Conversation
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 965d458).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/97133012
Marked work-in-progress: we should review all special-casing of |
965d458
to
d46cf18
Compare
bb4a135
to
aa1b446
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: aa1b446).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99429688
aa1b446
to
9f92ab9
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 9f92ab9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/101215749
9f92ab9
to
3d01c87
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 3d01c87).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/101250611
3d01c87
to
e254a6f
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: e254a6f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/101349909
e254a6f
to
1042845
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 1042845).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102431450
|
||
// increment/decrement on underlying type | ||
expr.op0() = typecast_exprt(expr.op0(), enum_type.subtype()); | ||
expr.type() = enum_type.subtype(); |
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 would make that an implicit typecast.
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 have added implicit_typecast_arithmetic(expr);
- is that what you expected?
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.
No, that's arithmetic promotion; I am not actually sure whether these are meant to happen to the underlying type of an enum.
What I meant is the ID_C_implicit_typecast
annotation, which is used to distinguish an explicit cast from one added by the frontend.
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 can't seem to find ID_C_implicit_typecast
or indeed any other annotation that the implicit_typecast
code would be adding?!
|
||
exprt new_lhs = skip_typecast(expr.op0()); | ||
rhs = typecast_exprt::conditional_cast(rhs, new_lhs.type()); | ||
rhs.add_source_location() = expr.source_location(); |
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.
Same here.
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 is outside the C front-end, I don't think I can use implicit_typecast(_arithmetic)
here?!
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.
Yes, you may have to add ID_C_implicit_typecast
directly.
1042845
to
25e854f
Compare
The front-ends handle type conversion when doing arithmetic over enum types. The case of an enum tag is not expected in goto-program conversion. That, however, was only the case for some operators. Made the C front-end properly handle all assignment operators. While at it, also support decrement operators over complex numbers. We already did so for increment, decrement just requires the same special case.
Doing so during goto-program conversion will ensure we can generate appropriate conversion checks. Fixes: diffblue#4208
25e854f
to
2043025
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 25e854f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102514059
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 2043025).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102521796
The front-ends handle type conversion when doing arithmetic over enum types. The
case of an enum tag is not expected in goto-program conversion. That, however,
was only the case for some operators. Made the C front-end properly handle all
assignment operators.