[Bug]: Uninitialized value in AnyInvocable.
- Lenguaje dominante
- C++
- Estrellas
- 18.1k
- Forks
- 3.2k
- Merge medio
- 20 h 36 min
- PR fusionados (30 d)
- 1
Descripción
### Describe the issue
Uninitialized value in AnyInvocable.
### Steps to reproduce the problem
When move from one instance of AnyInvocable to another, GCC v 12+ with -O2 or more and -Wall complains about uninitialized value used.
Example: https://godbolt.org/z/c4KMhcYcc
If change to -O1 - warning disappear.
```
In file included from /opt/compiler-explorer/libs/abseil/absl/functional/any_invocable.h:43,
from :1:
In function 'void absl::internal_any_invocable::LocalManagerTrivial(FunctionToCall, TypeErasedState*, TypeErasedState*)',
inlined from 'absl::internal_any_invocable::CoreImpl::CoreImpl(absl::internal_any_invocable::CoreImpl&&) [with bool SigIsNoexcept = false; ReturnType = void; P = {}]' at /opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:481:11,
inlined from 'absl::internal_any_invocable::Impl::Impl(absl::internal_any_invocable::Impl&&)' at /opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:868:1,
inlined from 'absl::AnyInvocable::AnyInvocable(absl::AnyInvocable&&) [with Sig = void()]' at /opt/compiler-explorer/libs/abseil/absl/functional/any_invocable.h:184:3,
inlined from 'int main()' at :7:49:
/opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:266:7: warning: 'fn.absl::AnyInvocable::.absl::internal_any_invocable::Impl::.absl::internal_any_invocable::CoreImpl::state_' is used uninitialized [-Wuninitialized]
266 | *to = *from;
| ~~~~^~~~~~~
: In function 'int main()':
:6:32: note: 'fn' declared here
6 | absl::AnyInvocable fn{[](){ std::cout << "test\n"; }};
| ^~
ASM generation compiler returned: 0
In file included from /opt/compiler-explorer/libs/abseil/absl/functional/any_invocable.h:43,
from :1:
In function 'void absl::internal_any_invocable::LocalManagerTrivial(FunctionToCall, TypeErasedState*, TypeErasedState*)',
inlined from 'absl::internal_any_invocable::CoreImpl::CoreImpl(absl::internal_any_invocable::CoreImpl&&) [with bool SigIsNoexcept = false; ReturnType = void; P = {}]' at /opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:481:11,
inlined from 'absl::internal_any_invocable::Impl::Impl(absl::internal_any_invocable::Impl&&)' at /opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:868:1,
inlined from 'absl::AnyInvocable::AnyInvocable(absl::AnyInvocable&&) [with Sig = void()]' at /opt/compiler-explorer/libs/abseil/absl/functional/any_invocable.h:184:3,
inlined from 'int main()' at :7:49:
/opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:266:7: warning: 'fn.absl::AnyInvocable::.absl::internal_any_invocable::Impl::.absl::internal_any_invocable::CoreImpl::state_' is used uninitialized [-Wuninitialized]
266 | *to = *from;
| ~~~~^~~~~~~
: In function 'int main()':
:6:32: note: 'fn' declared here
6 | absl::AnyInvocable fn{[](){ std::cout << "test\n"; }};
|
```
### What version of Abseil are you using?
latest from git
### What operating system and version are you using?
linux
### What compiler and version are you using?
gcc v 12.1
### What build system are you using?
none
### Additional context
_No response_
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.