<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - __builtin_memcpy_inline crashes the compiler"
   href="https://bugs.llvm.org/show_bug.cgi?id=52012">52012</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__builtin_memcpy_inline crashes the compiler
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>joshua@froggi.es
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25306" name="attach_25306" title="What it told me to attach.">attachment 25306</a> <a href="attachment.cgi?id=25306&action=edit" title="What it told me to attach.">[details]</a></span>
What it told me to attach.

Replacing memcpy's that have constant size with __builtin_memcpy_inline for a
JIT template causes a compiler crash.

clang-git 14.0.0.2021_08_25.1.a45d72e02-1
llvm-git 14.0.0.2021_08_25.1.a45d72e02-1
compiler-rt-git 14.0.0.2021_08_25.1.a45d72e02-1

Spew:

PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -m64 -fomit-frame-pointer -ffreestanding
-fno-strict-aliasing -O3 -D_FORTIFY_SOURCE=0 -fno-stack-protector -DN_DEBUG=1
-DNDEBUG=1 -DHAVE_TIMESPEC_GET -DHAVE_PTHREAD -DUTIL_ARCH_LITTLE_ENDIAN=1
-DUTIL_ARCH_BIG_ENDIAN=0 -DRADV_DESCRIPTOR_JIT_GENERATOR=1
-I/home/joshua/Code/mesa/build/src/vulkan/util -I/usr/include/libdrm
-I../../vulkan/util -I../../../include -I../../gallium/include
-I../../amd/common -I /home/joshua/Code/mesa/build/src/compiler/nir -I ../../
-I/home/joshua/Code/mesa/build/src/amd/common
-I/home/joshua/Code/mesa/build/src/amd/vulkan -I../../vulkan/wsi -emit-llvm -o
radv_update_descriptor_set.bc -c radv_update_descriptor_set.c
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      radv_update_descriptor_set.c:11:1: Generating code for declaration
'write_texel_buffer_descriptor'
 #0 0x00007f9ca4fb6c0b (/usr/bin/../lib/libLLVM-14git.so+0xbcec0b)
 #1 0x00007f9ca4fb46c5 llvm::sys::CleanupOnSignal(unsigned long)
(/usr/bin/../lib/libLLVM-14git.so+0xbcc6c5)
 #2 0x00007f9ca4eb7909 (/usr/bin/../lib/libLLVM-14git.so+0xacf909)
 #3 0x00007f9ca401fe20 __restore_rt libc_sigaction.c:0:0
 #4 0x00007f9cacec6a3e
clang::CodeGen::CodeGenModule::getNaturalPointeeTypeAlignment(clang::QualType,
clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*)
(/usr/bin/../lib/libclang-cpp.so.14git+0x2090a3e)
 #5 0x00007f9caccc0d46
clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(clang::Expr const*,
clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*)
(/usr/bin/../lib/libclang-cpp.so.14git+0x1e8ad46)
 #6 0x00007f9cacbf4eeb
clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::GlobalDecl, unsigned
int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot)
(/usr/bin/../lib/libclang-cpp.so.14git+0x1dbeeeb)
 #7 0x00007f9caccc6bab
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
(/usr/bin/../lib/libclang-cpp.so.14git+0x1e90bab)
 #8 0x00007f9cacd214a6 (/usr/bin/../lib/libclang-cpp.so.14git+0x1eeb4a6)
 #9 0x00007f9cacd1dd10
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/bin/../lib/libclang-cpp.so.14git+0x1ee7d10)
#10 0x00007f9caccac260 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/usr/bin/../lib/libclang-cpp.so.14git+0x1e76260)
#11 0x00007f9caccc659f
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/usr/bin/../lib/libclang-cpp.so.14git+0x1e9059f)
#12 0x00007f9cace3cb33 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/usr/bin/../lib/libclang-cpp.so.14git+0x2006b33)
#13 0x00007f9cace43272
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/bin/../lib/libclang-cpp.so.14git+0x200d272)
#14 0x00007f9cace9fe67
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/usr/bin/../lib/libclang-cpp.so.14git+0x2069e67)
#15 0x00007f9caceb145a
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/bin/../lib/libclang-cpp.so.14git+0x207b45a)
#16 0x00007f9caceefb04
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/bin/../lib/libclang-cpp.so.14git+0x20b9b04)
#17 0x00007f9caceebb61
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/bin/../lib/libclang-cpp.so.14git+0x20b5b61)
#18 0x00007f9cacef3b34 clang::CodeGen::CodeGenModule::EmitDeferred()
(/usr/bin/../lib/libclang-cpp.so.14git+0x20bdb34)
#19 0x00007f9cacef4fdc clang::CodeGen::CodeGenModule::Release()
(/usr/bin/../lib/libclang-cpp.so.14git+0x20befdc)
#20 0x00007f9cacf64efb (/usr/bin/../lib/libclang-cpp.so.14git+0x212eefb)
#21 0x00007f9cace9a5b5 (/usr/bin/../lib/libclang-cpp.so.14git+0x20645b5)
#22 0x00007f9caba519a9 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/bin/../lib/libclang-cpp.so.14git+0xc1b9a9)
#23 0x00007f9cad6425c9 clang::FrontendAction::Execute()
(/usr/bin/../lib/libclang-cpp.so.14git+0x280c5c9)
#24 0x00007f9cad5cc224
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/bin/../lib/libclang-cpp.so.14git+0x2796224)
#25 0x00007f9cad6c2999
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/bin/../lib/libclang-cpp.so.14git+0x288c999)
#26 0x000055dc85d6ac6e cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/bin/clang-14+0x12c6e)
#27 0x000055dc85d68249 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#28 0x00007f9cad2834a9 (/usr/bin/../lib/libclang-cpp.so.14git+0x244d4a9)
#29 0x00007f9ca4eb7a17
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/usr/bin/../lib/libLLVM-14git.so+0xacfa17)
#30 0x00007f9cad283904 (/usr/bin/../lib/libclang-cpp.so.14git+0x244d904)
#31 0x00007f9cad25588b
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/usr/bin/../lib/libclang-cpp.so.14git+0x241f88b)
#32 0x00007f9cad256389
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/usr/bin/../lib/libclang-cpp.so.14git+0x2420389)
#33 0x00007f9cad263bf3
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/usr/bin/../lib/libclang-cpp.so.14git+0x242dbf3)
#34 0x000055dc85d65aba main (/usr/bin/clang-14+0xdaba)
#35 0x00007f9ca400c7b3 __libc_start_call_main
/home/kevin/build/glibc-git/glibc-git/src/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#36 0x00007f9ca400c86e <a href="mailto:__libc_start_main@GLIBC_2.2.5">__libc_start_main@GLIBC_2.2.5</a>
/home/kevin/build/glibc-git/glibc-git/src/glibc/csu/../csu/libc-start.c:370:5
#37 0x000055dc85d67665 _start
/home/kevin/build/glibc-git/glibc-git/src/glibc/csu/../sysdeps/x86_64/start.S:118:0
clang-14: error: clang frontend command failed with exit code 139 (use -v to
see invocation)
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
a45d72e0247d080eb9437736bb6cadfc27e4c065)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-14: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-14: note: diagnostic msg: /tmp/radv_update_descriptor_set-f39d61.c
clang-14: note: diagnostic msg: /tmp/radv_update_descriptor_set-f39d61.sh
clang-14: note: diagnostic msg: 

********************</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>