<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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-3.8 crash with invalid? asm vector constraints"
   href="https://llvm.org/bugs/show_bug.cgi?id=25932">25932</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-3.8 crash with invalid? asm vector constraints
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>peter@cordes.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15513" name="attach_15513" title="preprocessed source, same as what's in the bug report.">attachment 15513</a> <a href="attachment.cgi?id=15513&action=edit" title="preprocessed source, same as what's in the bug report.">[details]</a></span>
preprocessed source, same as what's in the bug report.

While trying to guess at the right syntax for something, I crashed clang 3.7 on
godbolt (which recompiles every time you stop typing).  I boiled it down to a
fairly minimal testcase that still crashes clang 3.8~svn256236-1~exp1 (from
apt.llvm.org, on x86-64 Ubuntu 15.10).




//#include <immintrin.h>
typedef float __m512 __attribute__ ((vector_size (64)));

__m512 mul_broad(__m512 a, float b) {
    int j=0;
    asm(
    "vbroadcastss  %[scalar], %%zmm1\n\t"
    : [vec] "+Yt" (a), [scalar] "+x" (b)
    : [xv] "t" (j)
    :
    );
    return a;
}



I was trying to find the right syntax for something like `%z[scalar]` that
would expand to %zmm1 if the scalar was in %xmm1.  (Like %q[int_var] to get
%rax instead of %eax).  But that's not relevant to this bug report


compiler output:


$ clang-3.8 -O3 -Wall -march=haswell -mavx512f -fverbose-asm clang-crash.c
clang-crash.c:7:2: error: scalar-to-vector conversion failed, possible invalid
constraint for vector type
        "vbroadcastss  %[scalar], %%zmm1\n\t"
        ^
0  libLLVM-3.8.so.1 0x00007f43a369ad48
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1  libLLVM-3.8.so.1 0x00007f43a3699106 llvm::sys::RunSignalHandlers() + 54
2  libLLVM-3.8.so.1 0x00007f43a3699269
3  libpthread.so.0  0x00007f43a1c39d10
4  libLLVM-3.8.so.1 0x00007f43a32e2134
Stack dump:
0.      Program arguments: /usr/lib/llvm-3.8/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-main-file-name clang-crash.
c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu haswell
-target-feat
ure +avx512f -target-linker-version 2.25.1 -momit-leaf-frame-pointer
-dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0
 -internal-isystem /usr/local/include -internal-isystem
/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -i
nternal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-Wall -fdebug-compilation-dir /home/peter/bug/clang -ferror-limit 19
-fmessage-length 1
63 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -o /tmp/clang-crash-26cb81.o -x c clang-crash.c
1.      <eof> parser at end of file
2.      Code generation  
3.      Running pass 'Function Pass Manager' on module 'clang-crash.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function
'@mul_broad'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Ubuntu clang version 3.8.0-svn256236-1~exp1 (trunk) (based on LLVM 3.8.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin   
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://bugs.debian.org/">http://bugs.debian.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
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>