<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 - Clang frontend crash when using -o /dev/null with wasm"
   href="https://bugs.llvm.org/show_bug.cgi?id=41857">41857</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang frontend crash when using -o /dev/null with wasm
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>8.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>justin@postgresql.org
          </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=21942" name="attach_21942" title="Bugpoint simplified bitcode which the crash happens with">attachment 21942</a> <a href="attachment.cgi?id=21942&action=edit" title="Bugpoint simplified bitcode which the crash happens with">[details]</a></span>
Bugpoint simplified bitcode which the crash happens with

Stumbled on an unexpected bug with clang when using -o /dev/null, that seems to
happen only when generating for wasm:

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

$ clang --compile -v --target=wasm32-unknown-unknown-wasm -o /dev/null
bugpoint-reduced-simplified.ll
clang version 8.0.1 (<a href="https://git.llvm.org/git/clang.git">https://git.llvm.org/git/clang.git</a>
0a125120dc2ee0fe914542b605996bebaf0b8e9a) (<a href="https://git.llvm.org/git/llvm.git">https://git.llvm.org/git/llvm.git</a>
45a188afecbea2d2409cc282bdb91bf58da8b0c8)
Target: wasm32-unknown-unknown-wasm
Thread model: single
InstalledDir: /opt/llvm8/bin
 "/opt/llvm8/bin/clang-8" -cc1 -triple wasm32-unknown-unknown-wasm -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name bugpoint-reduced-simplified.ll -mrelocation-model static
-mthread-model single -masm-verbose -mconstructor-aliases -fuse-init-array
-target-cpu generic -fvisibility hidden -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -v -coverage-notes-file /dev/null.gcno -resource-dir
/opt/llvm8/lib/clang/8.0.1 -fdebug-compilation-dir
/home/jc/git_repos/src/github.com/tinygo-org/tinygo/src/examples/wasm/main
-ferror-limit 19 -fmessage-length 144 -fobjc-runtime=gnustep -fno-common
-fdiagnostics-show-option -fcolor-diagnostics -o /dev/null -x ir
bugpoint-reduced-simplified.ll
clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target
x86_64-unknown-linux-gnu
fatal error: error in backend: section size does not fit in a uint32_t
clang-8: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 8.0.1 (<a href="https://git.llvm.org/git/clang.git">https://git.llvm.org/git/clang.git</a>
0a125120dc2ee0fe914542b605996bebaf0b8e9a) (<a href="https://git.llvm.org/git/llvm.git">https://git.llvm.org/git/llvm.git</a>
45a188afecbea2d2409cc282bdb91bf58da8b0c8)
Target: wasm32-unknown-unknown-wasm
Thread model: single
InstalledDir: /opt/llvm8/bin
clang-8: 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-8: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

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

When giving any output filename (eg not /dev/null), the code generation works:

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

$ clang --compile -v --target=wasm32-unknown-unknown-wasm -o stuff
bugpoint-reduced-simplified.ll
clang version 8.0.1 (<a href="https://git.llvm.org/git/clang.git">https://git.llvm.org/git/clang.git</a>
0a125120dc2ee0fe914542b605996bebaf0b8e9a) (<a href="https://git.llvm.org/git/llvm.git">https://git.llvm.org/git/llvm.git</a>
45a188afecbea2d2409cc282bdb91bf58da8b0c8)
Target: wasm32-unknown-unknown-wasm
Thread model: single
InstalledDir: /opt/llvm8/bin
 "/opt/llvm8/bin/clang-8" -cc1 -triple wasm32-unknown-unknown-wasm -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name bugpoint-reduced-simplified.ll -mrelocation-model static
-mthread-model single -masm-verbose -mconstructor-aliases -fuse-init-array
-target-cpu generic -fvisibility hidden -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -v -coverage-notes-file
/home/jc/git_repos/src/github.com/tinygo-org/tinygo/src/examples/wasm/main/stuff.gcno
-resource-dir /opt/llvm8/lib/clang/8.0.1 -fdebug-compilation-dir
/home/jc/git_repos/src/github.com/tinygo-org/tinygo/src/examples/wasm/main
-ferror-limit 19 -fmessage-length 144 -fobjc-runtime=gnustep -fno-common
-fdiagnostics-show-option -fcolor-diagnostics -o stuff -x ir
bugpoint-reduced-simplified.ll
clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target
x86_64-unknown-linux-gnu

$ ls -la stuff
-rw-rw-r--. 1 jc jc 4090 May 13 21:21 stuff

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

Using /dev/null with non-wasm seems fine:

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

$ clang --compile -v -o /dev/null bugpoint-reduced-simplified.ll
clang version 8.0.1 (<a href="https://git.llvm.org/git/clang.git">https://git.llvm.org/git/clang.git</a>
0a125120dc2ee0fe914542b605996bebaf0b8e9a) (<a href="https://git.llvm.org/git/llvm.git">https://git.llvm.org/git/llvm.git</a>
45a188afecbea2d2409cc282bdb91bf58da8b0c8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm8/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/opt/llvm8/bin/clang-8" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name bugpoint-reduced-simplified.ll -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 -v -coverage-notes-file /dev/null.gcno
-resource-dir /opt/llvm8/lib/clang/8.0.1 -fdebug-compilation-dir
/home/jc/git_repos/src/github.com/tinygo-org/tinygo/src/examples/wasm/main
-ferror-limit 19 -fmessage-length 144 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /dev/null -x ir
bugpoint-reduced-simplified.ll -faddrsig
clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target
x86_64-unknown-linux-gnu
warning: overriding the module target triple with x86_64-unknown-linux-gnu
[-Woverride-module]
1 warning generated.

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

Attached is the bugpoint produced simplified bitcode file which this crash
happens on.  Hopefully helpful. :)

This may be related to the should-be-fixed bug here:
<a href="https://reviews.llvm.org/D57479">https://reviews.llvm.org/D57479</a>

So, possibly a regression?</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>