[LLVMbugs] [Bug 19451] New: Crash Using Clang on Android

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 16 14:10:47 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19451

            Bug ID: 19451
           Summary: Crash Using Clang on Android
           Product: clang
           Version: 3.4
          Hardware: Other
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mike.lentine at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140416/7e247982/attachment.html>


More information about the llvm-bugs mailing list