<html>
    <head>
      <base href="http://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 --- - Crash Using Clang on Android"
   href="http://llvm.org/bugs/show_bug.cgi?id=19451">19451</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash Using Clang on Android
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>other
          </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>mike.lentine@gmail.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>On Android NDK 9 the following code will cause a crash using the bundled
clang3.4 with -mfpu=neon. It crashes in the creation of the vector of
intrinsics. It seems to work with the bundled gcc4.8.

  #include <android/log.h>
  #include <vector>
  #include <arm_neon.h>

  #define SIZE 1000

  struct timeval start,end,diff;
  int iterations=1000;
  float final_sum;
  std::vector<float32x4_t> vectors;
  const float32_t sum_scalar[4] = { 0,0,0,0 };
  float32x4_t sum = vld1q_f32(sum_scalar);
  for(int i=0;i<SIZE;i++){
    const float32_t v_scalar[4] = {
(float)rand()/RAND_MAX,(float)rand()/RAND_MAX,(float)rand()/RAND_MAX,0 };
    float32x4_t vec = vld1q_f32(v_scalar);
    vectors.push_back(vec);
  }

  gettimeofday(&start,NULL);

  for(int k=0;k<iterations;k++) for(int i=0;i<SIZE;i++) for(int j=0;j<SIZE;j++)
sum=vaddq_f32(sum,vectors[j]);
  final_sum = vget_lane_f32(sum,0) + vget_lane_f32(sum,1) +
vget_lane_f32(sum,2);

  gettimeofday(&end,NULL);
  timersub(&end,&start,&diff);
  float timePassed=diff.tv_sec+diff.tv_usec/1000000.f;

  __android_log_print(ANDROID_LOG_VERBOSE, "NEON", "Sum %f",final_sum);
  __android_log_print(ANDROID_LOG_VERBOSE, "NEON", "Time %f",timePassed);</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>