Skip to content

Comparison of constant inttoptrs not folded #2701

@efriedma-quic

Description

@efriedma-quic
Bugzilla Link 2329
Resolution FIXED
Resolved on May 25, 2008 15:56
Version unspecified
OS Linux
CC @nlewycky

Extended Description

From GCC Bug 17141:

void abort (void);
struct a
{
int i;
} *a;
int f(void)
{
int *ii = &a->i;
void *l;
a->i = 1;
if (*ii)
l = &&l1;
else
l = &&l2;
goto *l;
l1:
return 0;
l2:
abort ();
}

This should fold to almost nothing, but we end up with a branch on a complicated constant expression:
br i1 icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*)), label %l2, label %l1

"icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*))" should fold to false.

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzilla

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions