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

             Bug #: 14005
           Summary: Clang duplicates arguments of "sub" instruction
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


We can write simple test:

#include <stdio.h>
int main()
{
    static const int ar = &&l2 - &&l1;
    if (ar == 0)
        printf("FAILED: l2-l1 == 0\n");
    else
        printf("PASSED\n");

    l1:
        return 10;
    l2:
        return 11;
}

where addresses of labels are different. So, their difference is not equal to
zero. But clang thinks, that they are the same.

If we look at internal representation we will see:

@main.ar = internal constant
i32 trunc (i64 sub (i64 ptrtoint (i8* blockaddress(@main, %l2) to i64),
                    i64 ptrtoint (i8* blockaddress(@main, %l2) to i64)) to
i32), align 4

that the arguments of instruction "sub" are duplicated. It's wrong.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to