<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 --- - [AArch64]Clang crush on an assertion when calling a NEON intrinsic with incorrect type in CPP file"
   href="https://llvm.org/bugs/show_bug.cgi?id=23414">23414</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64]Clang crush on an assertion when calling a NEON intrinsic with incorrect type in CPP file
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>Hao.Liu@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The test case is test.cpp
------------------------------------
#include <arm_neon.h>

int8x8_t test_vadd_s8(int8x16_t v1, int8x16_t v2) {
//  int8x8_t vadd_s8(int8x8_t a, int8x8_t b)
  return vadd_s8(v1, v2);
}

int8x8x2_t test_vld2_s8(float *a) {
//  int8x8x2_t vld2_s8(int8_t const * ptr)
  return vld2_s8(a);
}
------------------------------------

To reproduce the crush:
$clang -S -O3 -target aarch64 test.cpp 
unexpected Neon polynomial vector element type
UNREACHABLE executed at
/home/haoliu01/hd/src/repo/clang/lib/AST/ItaniumMangle.cpp:2317!
#0 0x26620c5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/haoliu01/hd/src/repo/llvm/lib/Support/Unix/Signals.inc:431:0
#1 0x26623da PrintStackTraceSignalHandler(void*)
/home/haoliu01/hd/src/repo/llvm/lib/Support/Unix/Signals.inc:489:0


But the C file test.c with the same code as test.cpp can report error/warning
correctly:
$clang -S -O3 -target aarch64 test.c
test.c:5:18: error: passing 'int8x16_t' (vector of 16 'int8_t' values) to
parameter of incompatible type
      'int8x8_t' (vector of 8 'int8_t' values)
  return vadd_s8(v1, v2);
                 ^~
/home/haoliu01/hd/src/repo/build/bin/../lib/clang/3.7.0/include/arm_neon.h:1077:32:
note: passing argument to
      parameter '__p0' here
__ai int8x8_t vadd_s8(int8x8_t __p0, int8x8_t __p1) {
                               ^
test.c:10:18: warning: incompatible pointer types assigning to 'const signed
char *' from 'float *'
      [-Wincompatible-pointer-types]
  return vld2_s8(a);
                 ^
/home/haoliu01/hd/src/repo/build/bin/../lib/clang/3.7.0/include/arm_neon.h:8949:33:
note: expanded from macro
      'vld2_s8'
  __builtin_neon_vld2_v(&__ret, __p0, 0); \
                                ^
1 warning and 1 error generated.


Also, GCC can report errors (I used the linaro toolchain):
$aarch64-linux-gnu-g++ -O3 -S test.cpp 
test.cpp: In function ‘int8x8_t test_vadd_s8(int8x16_t, int8x16_t)’:
test.cpp:5:24: error: cannot convert ‘int8x16_t {aka __vector(16)
__builtin_aarch64_simd_qi}’ to ‘int8x8_t {aka __vector(8)
__builtin_aarch64_simd_qi}’ for argument ‘1’ to ‘int8x8_t vadd_s8(int8x8_t,
int8x8_t)’
   return vadd_s8(v1, v2);
                        ^
test.cpp: In function ‘int8x8x2_t test_vld2_s8(float*)’:
test.cpp:10:19: error: cannot convert ‘float*’ to ‘const int8_t* {aka const
signed char*}’ for argument ‘1’ to ‘int8x8x2_t vld2_s8(const int8_t*)’
   return vld2_s8(a);
                   ^</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>