<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 - segfault with for loop and coverage-mapping"
   href="https://bugs.llvm.org/show_bug.cgi?id=36406">36406</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>segfault with for loop and coverage-mapping
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>5.0
          </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>remi@qumulo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19880" name="attach_19880" title="source code that causes crash">attachment 19880</a> <a href="attachment.cgi?id=19880&action=edit" title="source code that causes crash">[details]</a></span>
source code that causes crash

When I invoke coverage on C code that puts a break in the increment of a for
loop using a GCU C statement-expression it crashes code-coverage.

#0 0x0000000000f12e4d llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/qumulo/env/201802131428/bin/clang+0xf12e4d)
#1 0x0000000000f11ae5 llvm::sys::RunSignalHandlers()
(/opt/qumulo/env/201802131428/bin/clang+0xf11ae5)
#2 0x0000000000f11f24 SignalHandler(int)
(/opt/qumulo/env/201802131428/bin/clang+0xf11f24)
#3 0x00007f4a7017f3d0 __restore_rt
(/opt/qumulo/env/201802131428/bin/../lib/libpthread.so.0+0x113d0)
#4 0x000000000103ee31 llvm::SmallVectorTemplateBase<(anonymous
namespace)::CounterCoverageMappingBuilder::BreakContinue,
true>::push_back((anonymous
namespace)::CounterCoverageMappingBuilder::BreakContinue const&)
(/opt/qumulo/env/201802131428/bin/clang+0x103ee31)
#5 0x0000000001042964 clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/qumulo/env/201802131428/bin/clang+0x1042964)
#6 0x00000000010437ee (anonymous
namespace)::CounterCoverageMappingBuilder::VisitStmt(clang::Stmt const*)
(/opt/qumulo/env/201802131428/bin/clang+0x10437ee)
#7 0x000000000104203a clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/qumulo/env/201802131428/bin/clang+0x104203a)
#8 0x0000000001043699 (anonymous
namespace)::CounterCoverageMappingBuilder::propagateCounts(llvm::coverage::Counter,
clang::Stmt const*) (/opt/qumulo/env/201802131428/bin/clang+0x1043699)
#9 0x00000000010455ec
clang::CodeGen::CoverageMappingGen::emitCounterMapping(clang::Decl const*,
llvm::raw_ostream&) (/opt/qumulo/env/201802131428/bin/clang+0x10455ec)
#10 0x0000000001031eaa
clang::CodeGen::CodeGenPGO::emitCounterRegionMapping(clang::Decl const*)
(/opt/qumulo/env/201802131428/bin/clang+0x1031eaa)
#11 0x000000000103601d
clang::CodeGen::CodeGenPGO::assignRegionCounters(clang::GlobalDecl,
llvm::Function*) (/opt/qumulo/env/201802131428/bin/clang+0x103601d)
#12 0x00000000010150a4
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/opt/qumulo/env/201802131428/bin/clang+0x10150a4)
#13 0x0000000001025609
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/qumulo/env/201802131428/bin/clang+0x1025609)
#14 0x000000000103070a
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/qumulo/env/201802131428/bin/clang+0x103070a)
#15 0x0000000001030a43
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/opt/qumulo/env/201802131428/bin/clang+0x1030a43)
#16 0x0000000001030be4
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone
.part.5127] [clone .constprop.5133]
(/opt/qumulo/env/201802131428/bin/clang+0x1030be4)
#17 0x000000000139667c (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/qumulo/env/201802131428/bin/clang+0x139667c)
#18 0x0000000001392a44
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/qumulo/env/201802131428/bin/clang+0x1392a44)
#19 0x00000000015d1c51 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/qumulo/env/201802131428/bin/clang+0x15d1c51)
#20 0x0000000001394d39 clang::CodeGenAction::ExecuteAction()
(/opt/qumulo/env/201802131428/bin/clang+0x1394d39)
#21 0x00000000011d6ec7 clang::FrontendAction::Execute()
(/opt/qumulo/env/201802131428/bin/clang+0x11d6ec7)
#22 0x00000000011b9cb0
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/qumulo/env/201802131428/bin/clang+0x11b9cb0)
#23 0x000000000121c016
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/qumulo/env/201802131428/bin/clang+0x121c016)
#24 0x00000000009656ac cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/qumulo/env/201802131428/bin/clang+0x9656ac)
#25 0x0000000000931530 main (/opt/qumulo/env/201802131428/bin/clang+0x931530)
#26 0x00007f4a6eedd830 __libc_start_main
(/opt/qumulo/env/201802131428/bin/../lib/libc.so.6+0x20830)
#27 0x0000000000963d69 _start (/opt/qumulo/env/201802131428/bin/clang+0x963d69)
Stack dump:
0.      Program arguments: /opt/qumulo/env/201802131428/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name poop.c
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-fprofile-instrument=clang -femit-coverage-notes -femit-coverage-data
-fcoverage-mapping -resource-dir /opt/qumulo/env/201802131428/lib/clang/5.0.1
-internal-isystem /opt/qumulo/env/201802131428/lib/clang/5.0.1/include
-internal-externc-isystem
/opt/qumulo/pkg/libc6-dev/3-2.23-0ubuntu3/include/x86_64-linux-gnu
-internal-externc-isystem /opt/qumulo/pkg/libc6-dev/3-2.23-0ubuntu3/include
-internal-externc-isystem
/opt/qumulo/pkg/linux-libc-dev/3-4.4.0-21.37/include/x86_64-linux-gnu
-internal-externc-isystem /opt/qumulo/pkg/linux-libc-dev/3-4.4.0-21.37/include
-fdebug-compilation-dir /home/remi -ferror-limit 19 -fmessage-length 255
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/poop-f34b39.o -x c poop.c 
1.      <eof> parser at end of file
2.      poop.c:5:1: LLVM IR generation of declaration 'main'
3.      poop.c:5:1: Generating code for declaration 'main'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /qumulotools/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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/poop-0f0336.c
clang: note: diagnostic msg: /tmp/poop-0f0336.sh
clang: 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>