[LLVMbugs] [Bug 2329] New: Comparison of constant inttoptrs not folded

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu May 15 12:10:08 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2329

           Summary: Comparison of constant inttoptrs not folded
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


>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.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list