<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 - PowerPC64: clang crash during compilation of crafty"
   href="https://bugs.llvm.org/show_bug.cgi?id=44101">44101</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PowerPC64: clang crash during compilation of crafty
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>pkubaj@anongoth.pl
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22852" name="attach_22852" title="patch">attachment 22852</a> <a href="attachment.cgi?id=22852&action=edit" title="patch">[details]</a></span>
patch

Happens during compilation of games/crafty port on FreeBSD/powerpc64-elfv2:
cc -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -Wall
-Wno-array-bounds -pipe -O3 \
-mpopcnt -pthread -DHASHSTATS -DTRACE -DBOOKDIR=\"/usr/local/lib/crafty\" 
-DLOGDIR=\"/tmp\"  -DRCDIR=\"~/\"  -DTBDIR=\"/usr/local/lib/crafty/TB\" 
-DPERSDIR=\"/usr/local/lib/crafty/cpf\" -DSKILL -DCPUS=1 -DSYZYGY -DTEST
-DCPUS=4 -DUNIX -c crafty.c
cc: warning: argument unused during compilation: '-mpopcnt'
[-Wunused-command-line-argument]
In file included from <built-in>:338:
<command line>:12:9: warning: 'CPUS' macro redefined [-Wmacro-redefined]
#define CPUS 4
        ^
<command line>:9:9: note: previous definition is here
#define CPUS 1
        ^
Assertion failed: ((OpInfo.ConstraintType == TargetLowering::C_RegisterClass ||
OpInfo.ConstraintType == TargetLowering::C_Register || OpInfo.ConstraintType ==
TargetLowering::C_Immediate) && "Unknown constraint type!"), function
visitInlineAsm, file
/usr/src/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp, line
8274.
Stack dump:
0.      Program arguments: /usr/bin/cc -cc1 -triple
powerpc64-unknown-freebsd13.0 -emit-obj -disable-free -main-file-name crafty.c
-mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu ppc64 -target-feature +secure-plt -mfloat-abi hard
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer
-coverage-notes-file /tmp/usr/ports/games/crafty/work/crafty-25.2_1/crafty.gcno
-resource-dir /usr/lib/clang/9.0.0 -D HASHSTATS -D TRACE -D
BOOKDIR="/usr/local/lib/crafty" -D LOGDIR="/tmp" -D RCDIR="~/" -D
TBDIR="/usr/local/lib/crafty/TB" -D PERSDIR="/usr/local/lib/crafty/cpf" -D
SKILL -D CPUS=1 -D SYZYGY -D TEST -D CPUS=4 -D UNIX -O3 -Wall -Wno-array-bounds
-fdebug-compilation-dir /tmp/usr/ports/games/crafty/work/crafty-25.2_1
-ferror-limit 19 -fmessage-length 106 -pthread -stack-protector 2
-fno-signed-char -fobjc-runtime=gnustep -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -o crafty.o -x c
crafty.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'crafty.c'.
4.      Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on
function '@RootMoveList'
#0 0x00000000136f5e50 PrintStackTrace
/usr/src/contrib/llvm/lib/Support/Unix/Signals.inc:533:13
#1 0x00000000136f64cc /usr/src/contrib/llvm/lib/Support/Unix/Signals.inc:593:3
#2 0x00000000136f3790 RunSignalHandlers
/usr/src/contrib/llvm/lib/Support/Signals.cpp:67:5
#3 0x00000000136f6c44 SignalHandler
/usr/src/contrib/llvm/lib/Support/Unix/Signals.inc:375:3
#4 0x00000008151d176c handle_signal /usr/src/lib/libthr/thread/thr_sig.c:248:3
cc: error: unable to execute command: Abort trap (core dumped)
cc: error: clang frontend command failed due to signal (use -v to see
invocation)
FreeBSD clang version 9.0.0 (tags/RELEASE_900/final 372316) (based on LLVM
9.0.0)
Target: powerpc64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin


Obviously, passing -mpopcnt is a bug in crafty, but the point here is clang's
crash. I've attached the preprocessed souce file and the running script.</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>