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: unassignedclangb...@nondot.org Reporter: wolfgang_p...@playstation.sony.com CC: llvmbugs@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.
_______________________________________________ LLVMbugs mailing list LLVMbugs@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs