[LLVMbugs] [Bug 618] NEW: llc -march=c generates code that gcc does not compile

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Aug 23 10:42:57 PDT 2005


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=618

           Summary: llc -march=c generates code that gcc does not compile
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: llc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: eric at vanrietpaap.nl


"rem double %a, 1.0" generates an fmod when turned into a .s file (x86), which
is ok. Using llc -march=c generates a % operation that does not compile with gcc
(3.4.4) . Error message is: 
    rem-c-bug.c:103: error: pointer value used where a floating point value was
expected
    rem-c-bug.c:103: error: invalid operands to binary %

line 103 is: ltmp_0_3 = printf(l2_cast210, (((double )l2_cast210)%0x1p+0));


My .ll file is
%.LC0 = internal constant [13 x sbyte] c"hello %f...\0A\00"          ; [13 x sbyte]*

declare int %printf(sbyte*, ...)

int %main() {
    %cast210 = getelementptr [13 x sbyte]* %.LC0, long 0, long 0
    %d       = cast sbyte* %cast210 to double
    %r       = rem double %d, 1.0
    call int (sbyte*, ...)* %printf(sbyte* %cast210, double %r)
    ret int 0
}

My 'compile' script is:
llvm-as rem-c-bug.ll -f -o rem-c-bug.bc
llc rem-c-bug.bc -march=c -f -o rem-c-bug.c
gcc rem-c-bug.c -o rem-c-bug



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list