aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c
blob: 1bcf2a27ab90fb8e4f8870536046a63748a7bd5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* { 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++ }  8 } */ 
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++ } 23 } */
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++ }  38 } */
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;
}