-
Notifications
You must be signed in to change notification settings - Fork 277
Handle empty unions via dedicated expression #6408
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
I should also revisit #5667 once this is merged. |
src/util/std_expr.h
Outdated
class empty_union_exprt : public nullary_exprt | ||
{ | ||
public: | ||
empty_union_exprt(typet _type) |
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'd make that constructor explicit
.
77675d6
to
ef1ae12
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.
Yes. I'm probably being unhelpful but what happens if you have a pointer to one of these?
I don't think that would be a problem, as long as you never try to access any bytes in there. |
243bf48
to
79b7014
Compare
GCC and Clang support empty unions, which the C standard does not permit. We previously handled this special case by generating nil. This, however, is not supported by the bitvector back-end. Rather than coming up with selective handling of the otherwise unexpected nil, a proper expression is introduced (and handled). Fixes: diffblue#6163
79b7014
to
eff2507
Compare
Codecov Report
@@ Coverage Diff @@
## develop #6408 +/- ##
===========================================
- Coverage 75.98% 75.98% -0.01%
===========================================
Files 1523 1524 +1
Lines 164284 164290 +6
===========================================
+ Hits 124839 124843 +4
- Misses 39445 39447 +2
Continue to review full report at Codecov.
|
GCC and Clang support empty unions, which the C standard does not
permit. We previously handled this special case by generating nil. This,
however, is not supported by the bitvector back-end. Rather than coming
up with selective handling of the otherwise unexpected nil, a proper
expression is introduced (and handled).
Fixes: #6163