Skip to content

Build fails with Clang 7.0 due to local variable copies #3238

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

Closed
karkhaz opened this issue Oct 28, 2018 · 0 comments · Fixed by #3239 or #3301
Closed

Build fails with Clang 7.0 due to local variable copies #3238

karkhaz opened this issue Oct 28, 2018 · 0 comments · Fixed by #3239 or #3301

Comments

@karkhaz
Copy link
Collaborator

karkhaz commented Oct 28, 2018

When building with Clang 7.0, I'm getting thousands of errors like this.

cbmc/src/pointer-analysis/value_set_fivr.cpp:360:10: error: local variable 'od' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
  return od;
         ^~
/home/kareem/doc/cbmc/src/pointer-analysis/value_set_fivr.cpp:360:10: note: call 'std::move' explicitly to avoid copying
  return od;
         ^~
         std::move(od)

I'll fix these soon. Here's the environment:

> clang --version
clang version 7.0.0 (tags/RELEASE_700/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
karkhaz added a commit to karkhaz/cbmc that referenced this issue Oct 28, 2018
This commit fixes diffblue#3238, a warning emitted by clang 7.0:

```
java_bytecode_convert_method.cpp:2924:10: error: local variable
'block' will be copied despite being returned by name
[-Werror,-Wreturn-std-move]
  return block;
         ^~~~~
java_bytecode_convert_method.cpp:2924:10: note: call 'std::move'
explicitly to avoid copying
  return block;
         ^~~~~
         std::move(block)
```

The fix is to wrap all such returned local variables in a call to
std::move().
xbauch pushed a commit to xbauch/cbmc that referenced this issue Nov 9, 2018
This commit fixes diffblue#3238, a warning emitted by clang 7.0:

```
java_bytecode_convert_method.cpp:2924:10: error: local variable
'block' will be copied despite being returned by name
[-Werror,-Wreturn-std-move]
  return block;
         ^~~~~
java_bytecode_convert_method.cpp:2924:10: note: call 'std::move'
explicitly to avoid copying
  return block;
         ^~~~~
         std::move(block)
```

The fix is to wrap all such returned local variables in a call to
std::move().
karkhaz added a commit to karkhaz/cbmc that referenced this issue Nov 9, 2018
karkhaz added a commit to karkhaz/cbmc that referenced this issue Nov 9, 2018
karkhaz added a commit to karkhaz/cbmc that referenced this issue Nov 9, 2018
karkhaz added a commit to karkhaz/cbmc that referenced this issue Nov 9, 2018
karkhaz added a commit to karkhaz/cbmc that referenced this issue Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant