https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80344

            Bug ID: 80344
           Summary: -Wuninitialized triggering on a ctor on ARM
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

With this testcase, on ARM I see:

$ ./cc1plus -quiet -I. -Wuninitialized -O q.C 
q.C: In constructor ‘B::B()’:
q.C:4:7: warning: ‘<anonymous>’ is used uninitialized in this function
[-Wuninitialized]
   A() {}
       ^

Started with r245840.  The C++ ABI for ARM says that cdtors return "this"
instead of returning void, so in .original we have

<<cleanup_point <<< Unknown tree: expr_stmt
  *(struct 
  {
    ._0 e;
    int i;
    int j;
  } &) this = {CLOBBER} >>>>>;
{

}
<D.4688>:;
return this;

And the last line provokes the warning.

class A {
public:
  enum { } e;
  A() {}
  int i;
  int j;
};

class B {
  B();
  A a;
};

A
fn1()
{
  return A();
}

B::B() : a(fn1()) {}

Reply via email to