view gcc/testsuite/g++.dg/vect/pr50698.cc @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile }
// { dg-require-effective-target vect_float }

float mem[4096];
const int N=1024;

struct XYZ {
    float * mem;
    int n;
    float * x() { return mem;}
    float * y() { return x()+n;}
    float * z() { return y()+n;}
};

inline
void sum(float * x, float * y, float * z, int n) {
    for (int i=0;i!=n; ++i)
      x[i]=y[i]+z[i];
}

void sumS() {
    XYZ xyz; xyz.mem=mem; xyz.n=N;
    sum(xyz.x(),xyz.y(),xyz.z(),xyz.n);
}

// { dg-final { scan-tree-dump-not "run-time aliasing" "vect" } }