public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/31146]  New: forwprop does not look through casts
@ 2007-03-12 12:23 rguenth at gcc dot gnu dot org
  2007-03-12 14:59 ` [Bug tree-optimization/31146] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-03-12 12:23 UTC (permalink / raw)
  To: gcc-bugs

The following two testcases should produce the same code after forwprop1:

struct foo { int i[3]; };

void bar (void)
{
  struct foo Foo;
  int i;

  for (i=0; i<3; ++i)
    {
      void *p = &Foo.i[i];
      int *pi = (int *)p;
      if (pi != 0)
        {
          *pi = 0;
        }
    }
}

---

struct foo { int i[3]; };

void bar (void)
{
  struct foo Foo;
  int i;

  for (i=0; i<3; ++i)
    {
      void *p = &Foo.i[i];
      int *pi = (int *)p;
      if (p != 0)
        {
          *pi = 0;
        }
    }
}


(the difference is testing p != 0 vs. pi != 0)

This happens in tramp3d-v4 via placement new:

  for (i=0; i<3; ++i)
    new (&a[i]) double;

where placement new expands to the "wrong" test sequence.

Mine.


-- 
           Summary: forwprop does not look through casts
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: rguenth at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-05-02  9:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-12 12:23 [Bug tree-optimization/31146] New: forwprop does not look through casts rguenth at gcc dot gnu dot org
2007-03-12 14:59 ` [Bug tree-optimization/31146] " pinskia at gcc dot gnu dot org
2007-03-12 15:09 ` pinskia at gcc dot gnu dot org
2007-03-12 15:35 ` rguenth at gcc dot gnu dot org
2007-03-12 15:41 ` pinskia at gcc dot gnu dot org
2007-03-12 16:01 ` rguenth at gcc dot gnu dot org
2007-03-16 10:11 ` rguenth at gcc dot gnu dot org
2007-03-20 11:05 ` rguenth at gcc dot gnu dot org
2007-03-20 12:49 ` mueller at gcc dot gnu dot org
2007-05-02  9:13 ` rguenth at gcc dot gnu dot org
2007-05-02  9:17 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).