public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/28778]  New: strict-aliasing bug
@ 2006-08-18 21:07 mrs at apple dot com
  2006-08-18 21:11 ` [Bug tree-optimization/28778] " pinskia at gcc dot gnu dot org
                   ` (53 more replies)
  0 siblings, 54 replies; 56+ messages in thread
From: mrs at apple dot com @ 2006-08-18 21:07 UTC (permalink / raw)
  To: gcc-bugs

mrs $ cat /tmp/t2.cc
typedef long GLint;
void aglChoosePixelFormat(const GLint *);

void find(const int *alistp) {
  const int *blist;
  int list[32];
  if (alistp)
    blist = alistp;
  else {
    list[3] = 42;       /* this store disappears with -fstrict-aliasing */
    blist = list;
  }
  aglChoosePixelFormat((GLint*)blist);
}
mrs $ ./xgcc -B./ -S -O1 /tmp/t2.cc -fno-strict-aliasing && grep 42 t2.s
        li r0,42
mrs $ ./xgcc -B./ -S -O1 /tmp/t2.cc -fstrict-aliasing && grep 42 t2.s
mrs $ 

The store cannot be removed, as the converted pointer can be used inside the
aglChoosePixelFormat function to access the value.  Since the optimizer can't
see that it isn't used, the optimizer must assume it can as the function isn't
marked pure.  If it had been, then the optimization would be ok.

t2.cc.035t.dce1 is the first pass that doesn't have the store, t2.cc.034t.fre
has the store.

This worked in 3.3, but not 4.0.1.  This doesn't work in gcc version 4.2.0
20060815 (experimental) on powerpc-apple-darwin9.0.0d1, nor on
i686-apple-darwin8.


-- 
           Summary: strict-aliasing bug
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mrs at apple dot com


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


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

end of thread, other threads:[~2008-07-04 15:51 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-18 21:07 [Bug tree-optimization/28778] New: strict-aliasing bug mrs at apple dot com
2006-08-18 21:11 ` [Bug tree-optimization/28778] " pinskia at gcc dot gnu dot org
2006-08-18 21:12 ` mrs at apple dot com
2006-08-18 21:15 ` pinskia at gcc dot gnu dot org
2006-08-18 21:18 ` [Bug tree-optimization/28778] [4.0/4.1/4.2 Regression] alias bug with cast and call clobbered pinskia at gcc dot gnu dot org
2006-08-19 10:15 ` rguenth at gcc dot gnu dot org
2006-08-19 10:44 ` rguenth at gcc dot gnu dot org
2006-08-19 14:10 ` dberlin at gcc dot gnu dot org
2006-08-19 14:27 ` rguenth at gcc dot gnu dot org
2006-08-20 22:53 ` mmitchel at gcc dot gnu dot org
2006-08-21  1:34 ` dberlin at dberlin dot org
2006-08-21 16:34 ` janis at gcc dot gnu dot org
2006-08-25 19:57 ` drow at gcc dot gnu dot org
2006-08-25 20:51 ` drow at gcc dot gnu dot org
2006-08-25 20:57 ` drow at gcc dot gnu dot org
2006-08-25 22:12 ` drow at gcc dot gnu dot org
2006-08-26 15:15 ` drow at gcc dot gnu dot org
2006-08-26 20:30 ` rguenth at gcc dot gnu dot org
2006-08-26 20:42 ` rguenth at gcc dot gnu dot org
2006-08-26 23:25 ` drow at gcc dot gnu dot org
2006-08-27  4:12 ` dberlin at dberlin dot org
2006-08-27 14:20 ` rguenth at gcc dot gnu dot org
2006-08-27 15:41 ` dberlin at dberlin dot org
2006-08-27 15:50 ` rguenth at gcc dot gnu dot org
2006-08-27 16:00 ` dberlin at dberlin dot org
2006-08-27 17:56 ` drow at gcc dot gnu dot org
2006-08-27 20:25 ` mmitchel at gcc dot gnu dot org
2006-08-27 20:28 ` mmitchel at gcc dot gnu dot org
2006-08-27 20:51 ` dberlin at dberlin dot org
2006-08-27 21:09 ` dberlin at dberlin dot org
2006-08-28  8:43 ` rguenth at gcc dot gnu dot org
2006-09-09 17:55 ` dberlin at dberlin dot org
2006-09-16 18:09 ` steven at gcc dot gnu dot org
2006-09-16 20:03 ` dberlin at dberlin dot org
2006-09-26  4:44 ` acahalan at gmail dot com
2006-09-26  4:56   ` Andrew Pinski
2006-09-26  4:56 ` pinskia at physics dot uc dot edu
2006-09-26 14:17 ` acahalan at gmail dot com
2006-09-26 14:32 ` pinskia at gcc dot gnu dot org
2006-09-26 15:33 ` acahalan at gmail dot com
2006-09-26 15:47 ` dberlin at dberlin dot org
2006-09-26 15:49 ` pinskia at gcc dot gnu dot org
2006-09-26 15:57 ` pcarlini at suse dot de
2006-09-27  2:12 ` dberlin at dberlin dot org
2006-10-13 17:50 ` dberlin at gcc dot gnu dot org
2006-10-19 23:06 ` dberlin at gcc dot gnu dot org
2006-10-19 23:07 ` dberlin at gcc dot gnu dot org
2006-10-20  8:25 ` [Bug tree-optimization/28778] [4.0/4.1 " rguenth at gcc dot gnu dot org
2006-11-05 22:17 ` chuck at vertica dot com
2006-11-05 22:26 ` drow at gcc dot gnu dot org
2006-11-05 22:26 ` pinskia at gcc dot gnu dot org
2006-11-05 23:39 ` chuck at vertica dot com
2007-01-25 15:51 ` gdr at gcc dot gnu dot org
2007-02-07 22:52 ` pinskia at gcc dot gnu dot org
2007-02-14  9:09 ` mmitchel at gcc dot gnu dot org
2008-07-04 15:51 ` [Bug tree-optimization/28778] [4.1 " jsm28 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).