[Bug c++/103375] [12 regression] -Werror=uninitialized false positive on unittest-cpp since r12-5391-g0790c8aacdfb4f

2021-11-23 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103375

Marek Polacek  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|NEW |RESOLVED

--- Comment #4 from Marek Polacek  ---
The reduced test no longer warns.

The unreduced warns, but that seems to be a good thing, just switch the order
of these:

23480   TestRunner runner;
23481   RecordingReporter reporter;

Not a bug, IMHO.

[Bug c++/103375] [12 regression] -Werror=uninitialized false positive on unittest-cpp since r12-5391-g0790c8aacdfb4f

2021-11-23 Thread slyfox at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103375

--- Comment #3 from Sergei Trofimovich  ---
Proposed upstream workaround as
https://github.com/unittest-cpp/unittest-cpp/pull/185.

[Bug c++/103375] [12 regression] -Werror=uninitialized false positive on unittest-cpp since r12-5391-g0790c8aacdfb4f

2021-11-23 Thread slyfox at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103375

--- Comment #2 from Sergei Trofimovich  ---
Created attachment 51855
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51855=edit
a.cpp.cpp

Also attaching unmodified preprocessed original file as I might have removed
too much. Original example uses inheritance with virtual functions.

gcc complains as:

$ g++-12.0.0 -std=c++14 -Werror=uninitialized -c a.cpp.cpp
a.cpp.cpp: In constructor '{anonymous}::FixtureBase::FixtureBase()':
a.cpp.cpp:23467:19: error: member '{anonymous}::FixtureBase::reporter' is used
uninitialized [-Werror=uninitialized]
23467 |  : runner(reporter)
  |   ^~~~
cc1plus: some warnings being treated as errors

[Bug c++/103375] [12 regression] -Werror=uninitialized false positive on unittest-cpp since r12-5391-g0790c8aacdfb4f

2021-11-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103375

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2021-11-23
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #1 from Andrew Pinski  ---
Confirmed.

If you swap the order of runner and reporter you don't get the uninitialized
warning.


I do have to wonder if the warning should be improved in messaging here because
it is not obvious why this might be bad.
In this case maybe used before is initialized due to order of the variables or
something to that effect.

[Bug c++/103375] [12 regression] -Werror=uninitialized false positive on unittest-cpp since r12-5391-g0790c8aacdfb4f

2021-11-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103375

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
 CC||mpolacek at gcc dot gnu.org