[LLVMbugs] incorrect conversion of cast-ulong-to-uint to 0

Chris Lattner sabre at nondot.org
Mon May 26 16:48:33 PDT 2003


> In the third argument to printf below (UL/ui), the denominator
> is a cast of ulong to uint.  It is incorrectly converted to 0
> producing a divide-by-zero in the bc file.

Thanks, fixed:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20030526/003726.html
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20030526/003727.html

FYI: this now is correctly compiled to:

void %main(int %argc.1, sbyte** %argv.1) {
        %tmp.1 = call ulong %getL()
        %tmp.8 = and ulong %tmp.1, 4294967295
        %tmp.9 = div ulong %tmp.1, %tmp.8
        %tmp.4 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([14 x sbyte]* %.str_1, long 0, long 0), ulong %tmp.9 )
        ret void
}

-Chris




More information about the llvm-bugs mailing list