Skip to content

Work around G++ 8 warnings #2353

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

Merged
merged 2 commits into from
Jun 20, 2018
Merged

Conversation

tautschnig
Copy link
Collaborator

The previous G++-8 cleanup did not include unit tests.

@kroening
Copy link
Member

small_map.h: Would the clean solution be to use remove_const * ?

@tautschnig tautschnig self-assigned this Jun 14, 2018
GCC 8 warns about catching by value; this was not caught in the earlier cleanup
as it did not include unit tests.
@tautschnig
Copy link
Collaborator Author

I have added comments to clarify what GCC 8 is warning about. Assigning to @danpoe to review whether using realloc/memmove is actually safe for those.

@kroening
Copy link
Member

Add a static_assert that T is std::is_pod?

@tautschnig
Copy link
Collaborator Author

Add a static_assert that T is std::is_pod?

Possibly, but that would fail right now. Let's see what @danpoe will say.

@smowton
Copy link
Contributor

smowton commented Jun 20, 2018

It definitely is not -- it has a non-trivial destructor, for example. In my view this is the same situation as Minisat's vec type. Minisat uses vec<vec<X>> in places, and the compiler panics that memmove on vec, which has a nontrivial copy-constructor and destructor to cope with duplicating and deallocating its memory is surely dangerous. The warning specifically notes that vec is therefore not TriviallyCopyable (https://en.cppreference.com/w/cpp/named_req/TriviallyCopyable).

Unfortunately there is no "trivially movable" concept, which I would define something like "move-construct or move-assign followed by destroy original is equivalent to memmove". The vec type obeyed this non-concept, as the move operators nulled its data pointer making the destructor a no-op--I'm expecting the internals of the small-map stuff to behave similarly, but @danpoe knows in more detail.

Copy link
Contributor

@allredj allredj left a 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: 961b29a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/76791527

@kroening kroening merged commit 6048517 into diffblue:develop Jun 20, 2018
NathanJPhillips pushed a commit to NathanJPhillips/cbmc that referenced this pull request Aug 22, 2018
8a7893c Merge pull request diffblue#2375 from diffblue/unit-dependencies
9258284 fix build depenencies of unit test binary
f7cd161 Merge pull request diffblue#2371 from diffblue/fix-tests2
82753bc make test independent of index type
f5f32da Merge pull request diffblue#2364 from smowton/smowton/fix/autodetect-default-cxx-dialect
d437f60 Merge pull request diffblue#2368 from polgreen/doc_replace_func_bodies
6048517 Merge pull request diffblue#2353 from tautschnig/g++8-fixes2
e2e6d82 Merge pull request diffblue#2190 from tautschnig/more-stats
7210136 Make it clearer that <=> will always be stringified
560f82b Travis: test more g++ and clang versions
d46a55c Add new goto-instrument option print-global-state-size
961b29a Silence GCC 8's warning about using realloc/memmove on non-POD
ca1b03c Documentation wording for replace function bodies
d8c5a98 Cleanup options handling of count-eloc, list-eloc, print-path-lengths
6cd6d31 Unit test framwork: use references when catching exceptions
6882da6 Merge pull request diffblue#2367 from diffblue/fix-tests
bcc3bef make regression/cbmc/bounds_check1 independent of types used
4de4538 switch regression/cbmc/Typecast2 to preprocessed code
91a9c64 Amend two tests that explicitly target C++98
2b2b797 goto-gcc: select default language standard depending on emulated compiler
52a8afc Merge pull request diffblue#1898 from tautschnig/always-inline
cbe691b Merge pull request diffblue#2363 from diffblue/Makefile-TAR
9d40a9e Merge pull request diffblue#2365 from diffblue/solaris_errno
9efd705 add model for ___errno for Solaris 11
eaa2e05 update Solaris instructions
2f142d5 allow customizing the tar command for solver download
8cc1848 Merge pull request diffblue#1860 from tautschnig/restore-irept-sharing
fea5db0 Merge pull request diffblue#2361 from diffblue/fix-goto2
7c0d750 Merge pull request diffblue#2362 from smowton/smowton/fix/tolerate-cxx-namespace-attribute
e440a25 introduce INCOMPLETE_GOTO and turn guarded goto into a stateless pass
1f1835b C++ frontend: tolerate namespace attributes
cbce4bc Unit test of irept's public API
abdb044 Unit test to check that irept implements sharing
d58fd18 Silence the linter on assert in irep.h
3d64070 Partially revert "Use small intrusive pointer in irep"
688a0ab Macros are not needed outside translation units
9c93f59 Fully interpret __attribute__((always_inline))
d1f617b Apply symbol replacement in type_arg members

git-subtree-dir: cbmc
git-subtree-split: 8a7893c
@tautschnig tautschnig deleted the g++8-fixes2 branch January 11, 2019 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants