[llvm-bugs] [Bug 48294] New: Crash with __builtin_memcpy_inline when source is an array
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 25 01:20:21 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48294
Bug ID: 48294
Summary: Crash with __builtin_memcpy_inline when source is an
array
Product: clang
Version: 11.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: jasper.mattsson at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Created attachment 24208
--> https://bugs.llvm.org/attachment.cgi?id=24208&action=edit
Full backtrace from crash
__builtin_memcpy_inline uses custom type checking, and thus does not perform
default argument conversions. Basically, I invoked the builtin with a pointer
and an array as its arguments, expecting array-to-pointer decay to happen.
Instead, Clang crashed as codegen.
I'm not sure if default conversions should happen with __builtin_memcpy_inline,
but it probably should not crash.
Example code:
int main() {
char to, from[1];
__builtin_memcpy_inline(&to, from, 1);
}
Snippet from backtrace:
#4 0x00007f5c1668a2b3
clang::CodeGen::CodeGenModule::getNaturalTypeAlignment(clang::QualType,
clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*, bool)
(/usr/bin/../lib/libclang-cpp.so.11+0x1bd82b3)
#5 0x00007f5c1648cc42
clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(clang::Expr const*,
clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*)
(/usr/bin/../lib/libclang-cpp.so.11+0x19dac42)
#6 0x00007f5c163cca99
clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::GlobalDecl, unsigned
int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot)
(/usr/bin/../lib/libclang-cpp.so.11+0x191aa99)
#7 0x00007f5c1649379e
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/usr/bin/../lib/libclang-cpp.so.11+0x19e179e)
--
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/20201125/54cdbb96/attachment.html>
More information about the llvm-bugs
mailing list