This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/47679] [4.6 Regression] Strange uninitialized warning after SRA


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47679

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-10 16:20:13 UTC ---
So, before esra we have:
<bb 2>:
  aOldItem = getitem (); [return slot optimization]
  MEM[(struct optional_base *)&aNewItem].m_initialized = 0;
  D.3621_11 = MEM[(const struct optional_base *)this_2(D)];
  if (D.3621_11 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  D.3623_13 = MEM[(const long unsigned int &)this_2(D) + 8];
  MEM[(internal_type *)&aNewItem + 8B] = D.3623_13;
  MEM[(struct optional_base *)&aNewItem].m_initialized = 1;

<bb 4>:
  D.3628_14 = MEM[(const struct optional_base *)&aOldItem];
  D.3629_15 = !D.3628_14;
  D.3630_16 = MEM[(const struct optional_base *)&aNewItem];
  D.3631_17 = !D.3630_16;
  if (D.3629_15 == D.3631_17)
    goto <bb 5>;
  else
    goto <bb 7>;

<bb 5>:
  D.3632_18 = MEM[(const struct optional_base *)&aOldItem];
  if (D.3632_18 == 0)
    goto <bb 7>;
  else
    goto <bb 6>;

<bb 6>:
  D.3634_19 = MEM[(const long unsigned int &)&aOldItem + 8];
  D.3633_20 = MEM[(const long unsigned int &)&aNewItem + 8];
  D.3635_21 = D.3634_19 == D.3633_20;

<bb 7>:
  # D.3635_22 = PHI <0(4), 1(5), D.3635_21(6)>

which has aNewItem+8 uninitialized if aNewItem.m_initialized is false, but then
aNewItem+8 isn't used either, just the condition is not very simple.
Then eSRA comes in and puts in an uninitialized SSA_NAME on one side of the
PHI, but as the condition is too complicated we don't figure it out and warn
anyway.

Not sure what can be done about it though,
return (!x) != (!y) ? false : ( !x ? true : (*x) == (*y) ) ;
is simply too complicated even for the current predicate aware uninitialized
variable analysis (http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00706.html),
particularly figuring out that (*x) == (*y) is only invoked if !!x.

Another thing is why the MEM_REF in the diagnostic isn't printed as
aNewItem.m_storage.dummy_ or aNewItem.m_storage.dummy_.data or
aNewItem.m_storage.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]