public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/30708]  New: [4.1 Regression] Aliasing miscompilation
@ 2007-02-05 13:21 jakub at gcc dot gnu dot org
  2007-02-05 14:19 ` [Bug tree-optimization/30708] " rguenth at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-02-05 13:21 UTC (permalink / raw)
  To: gcc-bugs

struct obj_symbol
{
 struct obj_symbol *next;
 unsigned int size;
};

struct common_entry
{
 struct common_entry *next;
 struct obj_symbol *sym;
};

extern void do_something(struct obj_symbol *sym);

void obj_allocate_commons(struct obj_symbol *sym)
{
 struct common_entry *common_head = ((void *)0);

 for (; sym ; sym = sym->next) {
  struct common_entry **p, *n;
  for (p = &common_head; *p ; p = &(*p)->next)
   if (sym->size <= (*p)->sym->size)
    break;

  n = __builtin_alloca (sizeof(*n));
  n->next = *p;
  n->sym = sym;
  *p = n;
 }

 {
  struct common_entry *p;
  for (p = common_head; p ; p = p->next)
   do_something(p->sym);
 }
}

is miscompiled on gcc-4_1-branch at least on x84_64-linux, with -O2 and above
(but not with -fno-strict-aliasing).
The common_head = NULL initialization is removed as dead during 1st DCE pass,
but from quick skimming the reason for that seems to be incorrect aliasing
information.


-- 
           Summary: [4.1 Regression] Aliasing miscompilation
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-05 13:21 [Bug tree-optimization/30708] New: [4.1 Regression] Aliasing miscompilation jakub at gcc dot gnu dot org
2007-02-05 14:19 ` [Bug tree-optimization/30708] " rguenth at gcc dot gnu dot org
2007-02-21 15:17 ` rguenth at gcc dot gnu dot org
2008-07-04 15:57 ` 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).