[Bug tree-optimization/19637] Missed constant propagation with placement new

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Feb 10 15:25:00 GMT 2005


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-02-10 09:39 -------
It's CCP that for foo_void is able to propagate &i[0] into the comparison here:

  struct Foo * const this;
  void * D.1798;
  size_t D.1795;
  void * __p;
  int i[2];
  struct Foo * i.6;
  int D.1786;
  struct Foo * iftmp.5;
  void * D.1784;
  struct Foo * D.1783;

<bb 0>:
  __p_2 = &i[0];
  this_6 = (struct Foo *) __p_2;
  if (__p_2 != 0B) goto <L1>; else goto <L3>;


but not for foo_char, as here:

  struct Foo * const this;
  void * D.1821;
  size_t D.1818;
  void * __p;
  int i[2];
  struct Foo * i.4;
  int D.1778;
  struct Foo * iftmp.3;
  void * D.1776;
  char * i.2;
  struct Foo * D.1765;

<bb 0>:
  i.2_1 = (char *) &i;
  __p_3 = i.2_1;
  this_7 = (struct Foo *) __p_3;
  if (__p_3 != 0B) goto <L1>; else goto <L3>;


I guess CCP is confused by the cast.  So much for the char*/void* difference.

-- 


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



More information about the Gcc-bugs mailing list