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

            Bug ID: 20535
           Summary: UBSan breaks compilation of inline asm
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

$ cat tmp/ubsan/asm.c 
void clear_blocks_sse() {
    __asm__ volatile (
        "" : : "i"(128 * 6)
    );
}
$ ./bin/clang -c -fsanitize=undefined tmp/ubsan/asm.c -o asm.o
tmp/ubsan/asm.c:3:9: error: invalid operand for inline asm constraint 'i'
        "" : : "i"(128 * 6)
        ^
1 error generated.

This happens because 128 * 6 is not a compiled-time constant anymore - it is
instead a regular Value calculated by @llvm.smul.with.overflow.i32 intrinsic.

I'm not sure what is the best approach for fixing this. Should we check for
overflow statically if both operands of the checked binary op are constants?

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