[LLVMbugs] [Bug 24256] New: UBSan: constant operand required for __builtin_address()

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 24 14:38:01 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24256

            Bug ID: 24256
           Summary: UBSan: constant operand required for
                    __builtin_address()
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Wolfgang_Pieb at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

//========================
void *gGetCallStack() { return __builtin_frame_address(0 + 0); }
//========================

Compiled with the undefined behavior sanitizer enabled:

clang -fsanitize=undefined -c t.cpp

produces an assertion:
clang-3.7: /home/user/src/llvm/trunk/llvm/include/llvm/Support/Casting.h:237:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
llvm::ConstantInt; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type
= llvm::ConstantInt*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.

This is caused by clang not folding 0 + 0 but instead generating code
for it. The lowering of the LLVM builtin llvm.frameaddress is not prepared
for this and expects a constant.

This appears to be similar to bug 23517 for ARM builtins.

-- 
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/20150724/ee2ab5de/attachment.html>


More information about the llvm-bugs mailing list