view gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-fcilkplus -Wunknown-pragmas" } */

#define Q 4

int z = Q;

__attribute__ ((vector (uniform(x), vectorlength (), linear (y:1) ))) /* { dg-error "expected expression" "" { target c } } */ 
     /* { dg-error "expected primary-expression" "" { target c++ }  .-1 } */ 
int func2 (int x, int y)
{
  int zq = 5;
  return x + (y*zq);
}

__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (4.5) ))) /* { dg-error "vectorlength must be an integer" } */
int func3 (int x, int y)
{
  int zq = 5;
  return x + (y*zq);
}

__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (z) ))) /* { dg-error "vectorlength must be an integer" "" { target c } } */ 
     /* { dg-error "constant" "" { target c++ } .-1 } */
int func4 (int x, int y)
{
  int zq = 5;
  return x + (y*zq);
}

__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (Q) ))) /* This is OK!  */
int func5 (int x, int y)
{
  int zq = 5;
  return x + (y*zq);
}

__attribute__ ((vector (uniform(x), vectorlength (z), linear (y:1)))) /* { dg-error "vectorlength must be an integer" ""  { target c } } */ 
     /* { dg-error "constant" "" { target c++ }  .-1 } */
int func6 (int x, int y)
{
  int zq = 5;
  return x + (y*zq);
}

__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (sizeof (int)) ))) /* This is OK too!  */
int func7 (int x, int y)
{
  int zq = 5;
  return x + (y*zq);
}

int main (void)
{
  int ii = 0, q = 5;
  for (ii = 0; ii < 10; ii++)
    q += func2 (z, ii);
  return q;
}