You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <source>:1:
In function 'void absl::internal_any_invocable::LocalManagerTrivial(FunctionToCall, TypeErasedState*, TypeErasedState*)',
inlined from 'absl::internal_any_invocable::CoreImpl<SigIsNoexcept, ReturnType, P>::CoreImpl(absl::internal_any_invocable::CoreImpl<SigIsNoexcept, ReturnType, P>&&) [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<void()>::Impl(absl::internal_any_invocable::Impl<void()>&&)' at /opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:868:1,
inlined from 'absl::AnyInvocable<Sig>::AnyInvocable(absl::AnyInvocable<Sig>&&) [with Sig = void()]' at /opt/compiler-explorer/libs/abseil/absl/functional/any_invocable.h:184:3,
inlined from 'int main()' at <source>:7:49:
/opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:266:7: warning: 'fn.absl::AnyInvocable<void()>::<unnamed>.absl::internal_any_invocable::Impl<void()>::<unnamed>.absl::internal_any_invocable::CoreImpl<false, void>::state_' is used uninitialized [-Wuninitialized]
266 | *to = *from;
| ~~~~^~~~~~~
<source>: In function 'int main()':
<source>:6:32: note: 'fn' declared here
6 | absl::AnyInvocable<void()> 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 <source>:1:
In function 'void absl::internal_any_invocable::LocalManagerTrivial(FunctionToCall, TypeErasedState*, TypeErasedState*)',
inlined from 'absl::internal_any_invocable::CoreImpl<SigIsNoexcept, ReturnType, P>::CoreImpl(absl::internal_any_invocable::CoreImpl<SigIsNoexcept, ReturnType, P>&&) [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<void()>::Impl(absl::internal_any_invocable::Impl<void()>&&)' at /opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:868:1,
inlined from 'absl::AnyInvocable<Sig>::AnyInvocable(absl::AnyInvocable<Sig>&&) [with Sig = void()]' at /opt/compiler-explorer/libs/abseil/absl/functional/any_invocable.h:184:3,
inlined from 'int main()' at <source>:7:49:
/opt/compiler-explorer/libs/abseil/absl/functional/internal/any_invocable.h:266:7: warning: 'fn.absl::AnyInvocable<void()>::<unnamed>.absl::internal_any_invocable::Impl<void()>::<unnamed>.absl::internal_any_invocable::CoreImpl<false, void>::state_' is used uninitialized [-Wuninitialized]
266 | *to = *from;
| ~~~~^~~~~~~
<source>: In function 'int main()':
<source>:6:32: note: 'fn' declared here
6 | absl::AnyInvocable<void()> 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
The text was updated successfully, but these errors were encountered:
vitaliy-aksyonov
changed the title
[Bug]: Please title this bug report
[Bug]: Uninitialized value in AnyInvocable.
Jun 20, 2024
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.
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
The text was updated successfully, but these errors were encountered: