public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/94992] New: gcc thinks a member variable is uninitialised @ 2020-05-08 5:31 rafael at espindo dot la 2020-05-08 5:57 ` [Bug middle-end/94992] " pinskia at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: rafael at espindo dot la @ 2020-05-08 5:31 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94992 Bug ID: 94992 Summary: gcc thinks a member variable is uninitialised Product: gcc Version: 10.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: rafael at espindo dot la Target Milestone: --- Created attachment 48477 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48477&action=edit testcase In the attached testcase gcc with -O1 (but not -O0 or -O2) produces the following warning futures_test.cc:57:22: warning: ‘f2.my_future::_promise’ is used uninitialized in this function [-Wuninitialized] 57 | : _promise(x._promise) The produced assembly also uses uninitialized memory. The problem is that _promise is initialized to nullptr in the default constructor. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/94992] gcc thinks a member variable is uninitialised 2020-05-08 5:31 [Bug middle-end/94992] New: gcc thinks a member variable is uninitialised rafael at espindo dot la @ 2020-05-08 5:57 ` pinskia at gcc dot gnu.org 2020-05-08 5:58 ` pinskia at gcc dot gnu.org 2020-05-08 15:52 ` rafael at espindo dot la 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2020-05-08 5:57 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94992 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Comment on attachment 48477 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48477 testcase > my_future f2; > new (&f2) my_future(std::move(f2)); This is going to be problematic as f2 is being created but you are using the old object which has the same address as the new one. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/94992] gcc thinks a member variable is uninitialised 2020-05-08 5:31 [Bug middle-end/94992] New: gcc thinks a member variable is uninitialised rafael at espindo dot la 2020-05-08 5:57 ` [Bug middle-end/94992] " pinskia at gcc dot gnu.org @ 2020-05-08 5:58 ` pinskia at gcc dot gnu.org 2020-05-08 15:52 ` rafael at espindo dot la 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2020-05-08 5:58 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94992 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- AS mentioned. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/94992] gcc thinks a member variable is uninitialised 2020-05-08 5:31 [Bug middle-end/94992] New: gcc thinks a member variable is uninitialised rafael at espindo dot la 2020-05-08 5:57 ` [Bug middle-end/94992] " pinskia at gcc dot gnu.org 2020-05-08 5:58 ` pinskia at gcc dot gnu.org @ 2020-05-08 15:52 ` rafael at espindo dot la 2 siblings, 0 replies; 4+ messages in thread From: rafael at espindo dot la @ 2020-05-08 15:52 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94992 --- Comment #3 from Rafael Avila de Espindola <rafael at espindo dot la> --- For completeness, this is a reduction of a std::swap(x,x). The placement new was originally in the move assignment operator. I was able to reproduce this with gcc 9 by moving a few functions out of line. As far as I can tell, the relevant standard line is from basic.life: The lifetime of an object \placeholder{o} of type \tcode{T} ends when: ... \item the storage which the object occupies is released, or is reused by an object that is not nested within \placeholder{o}\iref{intro.object}. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-08 15:52 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-08 5:31 [Bug middle-end/94992] New: gcc thinks a member variable is uninitialised rafael at espindo dot la 2020-05-08 5:57 ` [Bug middle-end/94992] " pinskia at gcc dot gnu.org 2020-05-08 5:58 ` pinskia at gcc dot gnu.org 2020-05-08 15:52 ` rafael at espindo dot la
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).