[Bug c++/79345] [6/7 Regression] passing yet-uninitialized member as argument to base class constructor should warn (-Wunitialized)

2017-02-10 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79345

Jason Merrill  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #3 from Jason Merrill  ---
Compiling with -fno-lifetime-dse brings back the warning, so it seems that the
-Wuninitialized code is improperly treating the clobber as initialization.

[Bug c++/79345] [6/7 Regression] passing yet-uninitialized member as argument to base class constructor should warn (-Wunitialized)

2017-02-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79345

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|--- |6.4

[Bug c++/79345] [6/7 Regression] passing yet-uninitialized member as argument to base class constructor should warn (-Wunitialized)

2017-02-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79345

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-02-08
 CC||msebor at gcc dot gnu.org
Summary|passing yet-uninitialized   |[6/7 Regression] passing
   |member as argument to base  |yet-uninitialized member as
   |class constructor should|argument to base class
   |warn (-Wunitialized)|constructor should warn
   ||(-Wunitialized)
 Ever confirmed|0   |1

--- Comment #2 from Martin Sebor  ---
Confirmed.  Bisection points to r222135 (gcc 6.0.0):

r222135 | jason | 2015-04-15 17:17:29 -0400 (Wed, 15 Apr 2015) | 5 lines

* constexpr.c (cxx_eval_store_expression): Ignore clobbers.
(build_constexpr_constructor_member_initializers): Loop to find
the BIND_EXPR.
* decl.c (start_preparsed_function): Clobber the object at the
beginning of a constructor.


A somewhat simplified test case:

struct A {
  A (int);
};

struct B: A {
  const bool x = true;

  B (): A (x ? 3 : 7) { }
};

void f (void*);
void g ()
{
  B b;
  f (&b);
}