-
Notifications
You must be signed in to change notification settings - Fork 274
Handle empty structs in the back-end (and a number of induced fixes) #2161
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
bacc8c1
to
2b09684
Compare
51c11f8
to
02a13a2
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.
This PR failed Diffblue compatibility checks (cbmc commit: 51c11f8).
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
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: 02a13a2).
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.
Couple of things to check, otherwise lgtm
src/util/pointer_offset_size.cpp
Outdated
if(cellidx < 0 || !cellidx.is_long()) | ||
const array_typet &array_type = to_array_type(source_type); | ||
|
||
// no arrays of non-byte, zero-, or unknown-sized objects |
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.
non-byte-aligned?
regression/systemc/Array4/test.desc
Outdated
main.cpp | ||
-DNO_IO -DNO_STRING | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
warning: ignoring byte_extract_little_endian |
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.
Do you mean this to be a comment?
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.
Yeah... along with the previous line that does seem a little bizaar.
|
||
return object_rec(rest, pointer_type, tmp); | ||
return plus_exprt( | ||
address_of_exprt(deep_object.op0(), pointer_type(char_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.
Doesn't this need an explicit typecast?
Needs to be rebased once #3185 is merged. |
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.
A few minor comments. Shouldn't take much after the rebase.
regression/cbmc/Empty_struct2/main.c
Outdated
#pragma pack(1) | ||
struct S | ||
{ | ||
int x; |
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.
If I was a complete sadist I might suggest making this an int8_t
because then we have to deal with the packing rules around an empty structure. If y
was one as well you'd hope that sizeof(struct S)
would be sizeof(int8_t) * 2
rather than 2 (or 3) times the minimum alignment unit.
regression/systemc/Array4/test.desc
Outdated
main.cpp | ||
-DNO_IO -DNO_STRING | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
warning: ignoring byte_extract_little_endian |
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.
Yeah... along with the previous line that does seem a little bizaar.
return src; | ||
return plus_exprt( | ||
address_of_exprt(deep_object.op0(), pointer_type(char_type())), | ||
from_integer(pointer.offset / subtype_bytes, index_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.
As above.
src/util/pointer_offset_size.cpp
Outdated
|
||
if( | ||
offset * 8 >= m_offset_bits && m_offset_bits % 8 == 0 && | ||
offset * 8 + target_size <= m_offset_bits + m_size) |
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.
8? Are we really hard-coded to have 8-bit bytes?
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.
Well, once #917 is merged (after me reworking some of it) that should no longer be the case.
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.
OK; I'll leave this one for now.
02a13a2
to
0d005d5
Compare
We now support pointers into structs with zero-sized members, which is a GCC extension that we otherwise do support.
0d005d5
to
d4296f1
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: d4296f1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/89834675
I will need to break this PR apart, but I'll publish it in full for visibility. My original intent was just to fix the problem didn't handle empty structs (regression test included), which causes unnecessary failures in SV-COMP.
While I will split it up to enable reasonable reviewing, it should actually be clean and be ready for an evaluation against test-gen.