[llvm-bugs] [Bug 34187] New: Capturing const bit-field struct in clang block causes compiler crash with -O3

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 14 15:01:41 PDT 2017


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

            Bug ID: 34187
           Summary: Capturing const bit-field struct in clang block causes
                    compiler crash with -O3
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: remi at qumulo.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18983
  --> https://bugs.llvm.org/attachment.cgi?id=18983&action=edit
c program that causes the crash

Something about using const struct with bitfield and capturing it in a clang
block causes the compiler to crash:

$ /usr/bin/clang -O3 -fblocks bug.c

#0 0x00007f150fd39488 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x6ee488)  
#1 0x00007f150fd3756e llvm::sys::RunSignalHandlers()
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x6ec56e)                  
#2 0x00007f150fd376aa (/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x6ec6aa)  
#3 0x00007f15125b7670 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11670)                                 
#4 0x00007f150fe33784 llvm::PointerType::get(llvm::Type*, unsigned int)
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x7e8784)
#5 0x00007f15106d7b8d (/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x108cb8d) 
#6 0x00007f15106dc511 (/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x1091511) 
#7 0x00007f15106dc3e5 (/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x10913e5) 
#8 0x00007f15106e92b9 llvm::SROA::runOnAlloca(llvm::AllocaInst&)
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x109e2b9)     
#9 0x00007f15106ea5ee llvm::SROA::runImpl(llvm::Function&,
llvm::DominatorTree&, llvm::AssumptionCache&)
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x109f5ee)
#10 0x00007f15106eb705
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x10a0705)                       
#11 0x00007f150fe05c92 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x7bac92)
#12 0x00007f150fe05dce
llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&)
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x7badce)
#13 0x00007f150fe06316 llvm::legacy::FunctionPassManager::run(llvm::Function&)
(/usr/lib/llvm-4.0/bin/../lib/libLLVM-4.0.so.1+0x7bb316)
#14 0x00005575bcdbe200 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/lib/llvm-4.0/bin/clang+0x588200)
#15 0x00005575bd208770 (/usr/lib/llvm-4.0/bin/clang+0x9d2770)  
#16 0x00005575bd32a5e8 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-4.0/bin/clang+0xaf45e8)                        
#17 0x00005575bd0e290e clang::FrontendAction::Execute()
(/usr/lib/llvm-4.0/bin/clang+0x8ac90e)                                 
#18 0x00005575bd0b36f6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-4.0/bin/clang+0x87d6f6)   
#19 0x00005575bd164cd3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-4.0/bin/clang+0x92ecd3)       
#20 0x00005575bcd794d8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-4.0/bin/clang+0x5434d8)        
#21 0x00005575bcd6a576 main (/usr/lib/llvm-4.0/bin/clang+0x534576)              
#22 0x00007f150e7ca3f1 __libc_start_main
/build/glibc-mXZSwJ/glibc-2.24/csu/../csu/libc-start.c:325:0                    
#23 0x00005575bcd7772a _start (/usr/lib/llvm-4.0/bin/clang+0x54172a)            
Stack dump:                    
0.      Program arguments: /usr/lib/llvm-4.0/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name bug.c -mrelocation-model static
-mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer
-dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/lib/llvm-4.0/bin/../lib/clang/4.0.0 -internal-isystem /usr/local/include
-internal-isystem /usr/lib/llvm-4.0/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir /home/remi -ferror-limit 19 -fmessage-length 127
-fblocks -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -o /tmp/bug-1f8073.o -x c bug.c 
1.      <eof> parser at end of file                            
2.      Per-function optimization                              
3.      Running pass 'SROA' on function '@__main_block_invoke' 
clang: error: unable to execute command: Segmentation fault    
clang: error: clang frontend command failed due to signal (use -v to see
invocation)                                           
clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1)            
Target: x86_64-pc-linux-gnu    
Thread model: posix            
InstalledDir: /usr/bin         
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:   
********************           

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

********************

-- 
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/20170814/70b7b751/attachment-0001.html>


More information about the llvm-bugs mailing list