This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/30708] New: [4.1 Regression] Aliasing miscompilation
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Feb 2007 13:20:50 -0000
- Subject: [Bug tree-optimization/30708] New: [4.1 Regression] Aliasing miscompilation
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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