https://bugs.llvm.org/show_bug.cgi?id=45646
Bug ID: 45646
Summary: __builtin_bit_cast hits unreachable when casting a
cast pointer
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: john.br...@arm.com
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@metafoo.co.uk
If I compile
long fn() {
return __builtin_bit_cast(long, (long)&fn);
}
I get
LValue subobject in bit_cast?
UNREACHABLE executed at
/home/jb/work/llvm-project/clang/lib/AST/ExprConstant.cpp:6331!
With a backtrace that shows this happened when trying to evaluate the
__builtin_bit_cast as a constant expression during CodeGen.
This rather odd use of __builtin_bit_cast came originally from
cmse_nsfptr_create which is a macro defined in arm_cmse.h (in
clang/lib/Headers) as
#define cmse_nsfptr_create(p)
\
__builtin_bit_cast(__typeof__(p),
\
(__builtin_bit_cast(uintptr_t, p) & ~(uintptr_t)1))
so you get this failure if you do (compiling with clang --target=arm-none-eabi
-mcpu=cortex-m33 -mcmse)
#include <arm_cmse.h>
unsigned fn() {
cmse_nsfptr_create((unsigned)&fn);
}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs