<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 - crash when using "-ftime-trace" and "-o /dev/null""
   href="https://bugs.llvm.org/show_bug.cgi?id=43555">43555</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash when using "-ftime-trace" and "-o /dev/null"
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mbeardsl@mathworks.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=22626" name="attach_22626" title="Preprocessed source(s) and associated run script(s)">attachment 22626</a> <a href="attachment.cgi?id=22626&action=edit" title="Preprocessed source(s) and associated run script(s)">[details]</a></span>
Preprocessed source(s) and associated run script(s)

The following clang command crashes:
$ clang-9 -o /dev/null -c -ftime-trace tiny.cpp


tiny.cpp contents are as follows (the actual program doesn't matter)

int foo();

int foo() {
    return 5;
}



clang output/stack/etc:

$ clang-9 -o /dev/null -c -ftime-trace tiny.cpp
error: unable to open output file '/dev/null.json': 'Permission denied'
Stack dump:
0.      Program arguments:
/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name tiny.cpp
-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 -coverage-notes-file
/dev/null.gcno -resource-dir
/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/lib/clang/9.0.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/lib/clang/9.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/mbeardsl/Desktop/cpp/cpp
-ferror-limit 19 -fmessage-length 0 -ftime-trace -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-faddrsig -o /dev/null -x c++ tiny.cpp 
 #0 0x0000000002087814 PrintStackTraceSignalHandler(void*)
(/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9+0x2087814)
 #1 0x00000000020856ce llvm::sys::RunSignalHandlers()
(/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9+0x20856ce)
 #2 0x0000000002087c08 SignalHandler(int)
(/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9+0x2087c08)
 #3 0x00007f2a6c6da0c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
 #4 0x000000000208d2ba llvm::json::OStream::objectBegin()
(/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9+0x208d2ba)
 #5 0x0000000002057e27 llvm::TimeTraceProfiler::Write(llvm::raw_pwrite_stream&)
(/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9+0x2057e27)
 #6 0x00000000009e3dbb cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9+0x9e3dbb)
 #7 0x00000000009e1f5f main
(/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9+0x9e1f5f)
 #8 0x00007f2a6b25d2b1 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b1)
 #9 0x00000000009df129 _start
(/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang-9+0x9df129)
clang-9: error: unable to execute command: Segmentation fault
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (<a href="https://github.com/llvm-mirror/llvm">https://github.com/llvm-mirror/llvm</a>
c62b24f070c9a4bb1a76409e623042a740cac4cd)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/mbeardsl/clang9/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin
clang-9: note: diagnostic msg: 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.
clang-9: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/tiny-95ec21.cpp
clang-9: note: diagnostic msg: /tmp/tiny-95ec21.sh
clang-9: note: diagnostic msg: 

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



clang's generated files "/tmp/tiny-95ec21.cpp" and "/tmp/tiny-95ec21.sh" are
attached in clang_generated_repro_files.zip



When giving any real (non-/dev/null) file name for "-o", everything works of
course</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>