[LLVMbugs] [Bug 14005] New: Clang duplicates arguments of "sub" instruction

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 3 05:22:09 PDT 2012


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: unassignedclangbugs at nondot.org
        ReportedBy: ili.filippov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    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.



More information about the llvm-bugs mailing list