File: err-ptr.ispc

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (50 lines) | stat: -rw-r--r-- 1,103 bytes parent folder | download | duplicates (2)
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
// RUN: not %{ispc} --target=host --nowrap --nostdlib %s -o - 2>&1 | FileCheck %s

// CHECK: Error: Illegal to pre/post increment

void *foo1(void *p) {
    ++p;
}

// CHECK: Error: Illegal to perform pointer arithmetic

void *foo3(void *p) {
    p = p-2;
    return p;
}

// CHECK: Error: Illegal to perform pointer arithmetic

void *foo4(void *p) {
    p += 1;
    return p;
}

// CHECK: Error: Can't assign to type "const uniform int32 * const varying"

void fooptr1(const int * const p) {
    ++p;
}

// CHECK: Error: Can't assign to type "const varying int32" on left-hand side

void fooptr2(const int * p) {
    *p = 0;
}

// CHECK: Error: Conversion between incompatible pointer types

export void f_f_in(uniform float RET[], uniform float aFOO[]) {
    uniform int8 * varying pa = (uniform int8 *)aFOO;
    RET[programIndex] = aFOO - pa;
}

export void result_in(uniform float RET[]) {
    RET[programIndex] = 40;
}

// CHECK: Error: Can't convert from pointer type "void * varying" to incompatible pointer type "uniform int32 * varying" for return statement

int *foo(void *p) {
    return p;
}