[LLVMbugs] [Bug 20535] New: UBSan breaks compilation of inline asm

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 4 14:21:42 PDT 2014


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: unassignedclangbugs at nondot.org
          Reporter: vonosmas at gmail.com
                CC: llvmbugs at cs.uiuc.edu, richard-llvm at metafoo.co.uk
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140804/ad0d4e87/attachment.html>


More information about the llvm-bugs mailing list