-
Notifications
You must be signed in to change notification settings - Fork 101
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
Convert references more consistently #1696
Conversation
1af1a5d
to
62b20d4
Compare
Very nice PR :-) |
@XLiZHI you worked on the CUDA OMs in the past. Could I ask whether you have an insight into why the CUDA tests are failing here or how to produce a reduced version of a failing test case? As these are C++-frontend changes I don't expect interleavings to play any role, so ideally a failing CUDA test case with just a single thread would be great to have. |
Hi @fbrausse , The counterexample seem to be array out of bounds problem, I suggest that we can start from the TCs of C++, such as I think maybe fixing these TCs will solve the problems in the CUDA TCs. |
d74df91
to
ebd52b9
Compare
OK, I'm reasonably happy so far, but 3 issues remain with this PR, as far as I can see:
Besides that, the changes (mainly: treating conversions between references (modelled as pointers) and the actual values as implicit via gen_typecast()) do introduce a lot of As I've got to turn my attention to other things, I would be happy if someone could give me a hand in fixing these remaining issues. |
Update: this is the current list of failing tests: ctest8.1.txt |
Thanks, Lucas. It's not clear to me how to split this PR into smaller parts right now, except for the OMs. I believe the above mentioned issues are fixed now. Let's see what the CI says. For some reason symbolic types now arrive in the dereference module. Might be because of the temporary_object expressions, not sure, yet. It's easy to work-around via ns.follow(), though. |
c2d4d89
to
4120e6c
Compare
This is in order to be able to take the address.
…alizers This is being taken care of by c_typecast now.
…ion" This reverts commit b8afb21.
6b376e8
to
0d2634f
Compare
…s reference See also <https://cplusplus.github.io/LWG/issue1280>. Fixes (at least) - regression/esbmc-cpp/cpp/ch21_19
This reverts commit 4350f66.
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'm impressed by the number of regression tests that you have enabled with this PR! Well done!
Thanks for submitting this PR, @fbrausse.
Thanks, as a note of caution though: I had to disable one of @kunjsong01's optimizations, which means we now create more symbols for temporary values (such as the C++ constructors are using). This may lead to a slow-down for C++/Solidity, but I gathered it's better to be more correct than fast here. |
Yes, I fully support this. |
BTW, can I ask you to start an SV-COMP run here, @fbrausse? |
Master:
This PR:
The 2 new incorrect are in no-data-race:
Interestingly, there are also unknown -> correct (and unknown -> timeout) ones in no-data-race, that had the same problem on master. Besides that, there are 6 timeout -> out-of-memory ones in unreach-call (while all the other benchmarks don't seem to have significantly different memory usage):
I'll check whether those are noise. |
Many thanks, @fbrausse. This PR is a great addition to the ESBMC project. These results are great! If there are still further improvements, we could write small PRs. |
"implicit typecast of reference to incompatible non-reference type?"); | ||
} | ||
} | ||
else if (dest_type.id() == "pointer") |
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.
We used the else if
here, which allows us to skip the subsequent adjustments, which I think is why we encountered ERROR: Can't construct rvalue reference to array type during dereference (It isn't allowed by C anyway)
.
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.
Update: Until cc23115 esbmc did not appear this error, it affects some OM TCs at present, for example stack
.
struct B
{
};
struct list
{
B list[10];
};
int main ()
{
list mylist;
return 0;
}
void *operator new(std::size_t count, void *ptr) | ||
{ | ||
return ptr; | ||
} |
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.
why we need placement new?
I believe this PR is quite ready now. It does 3 things:
this
parameter now. Before, it had been added (only in some cases, leading to bugs) by the adjustment phase.#reference
or#rvalue_reference
flag set) and the concrete values are now done during the implicit casts performed by c_typecast. The effect is that for almost all¹ case, member accesses now work as they are expected to by the clang-c frontend, which the clang-cpp one derives from.¹ There is one corner case that doesn't work, yet: initialization of a member of reference type with another reference. With this PR, both are dereferenced and assigned. This is not intentional and will be addressed soon.
As a summary, 271 KNOWNBUGs have been fixed, but 5 new ones were added:
(this is a logic error in the dereference module about zero-sized structs)
regression/esbmc-cpp/template/template_sort_string: ERROR: Can't construct rvalue reference to array type during dereference (It isn't allowed by C anyway)
Additionally, I've disabled one of the unit tests, which was also constructing an address_of of
an address_ofa constant. This is not supported: addresses only exist for symbols or dereferenced expressions.Edit: Oh, and some bugs have been fixed in <vector>, <iterator> and <string_view> OMs.