libclc fails to compile with clang/llvm git

In file included from ./generic/lib/shared/vstore.cl:83:
In file included from ./generic/include/clc/math/gentype.inc:7:
./generic/lib/shared/vstore_half.inc:7:3: error: assigning directly to
pointer to type 'half' requires cl_khr_fp16. Use vector data store
builtin functions instead
  FUNC(, 1, __CLC_GENTYPE, __private);
  ^
./generic/lib/shared/vstore.cl:80:42: note: expanded from macro 'FUNC'
#define FUNC(SUFFIX, VEC_SIZE, TYPE, AS) __FUNC(SUFFIX, VEC_SIZE, TYPE, AS)
                                         ^
./generic/lib/shared/vstore.cl:77:5: note: expanded from macro '__FUNC'
    VEC_STORE##VEC_SIZE(vec) \
    ^
<scratch space>:70:1: note: expanded from here
VEC_STORE1
^
./generic/lib/shared/vstore.cl:56:39: note: expanded from macro 'VEC_STORE1'
#define VEC_STORE1(val) mem[offset++] = val;
                                      ^
In file included from ./generic/lib/shared/vstore.cl:83:
In file included from ./generic/include/clc/math/gentype.inc:7:
./generic/lib/shared/vstore_half.inc:8:3: error: assigning directly to
pointer to type 'half' requires cl_khr_fp16. Use vector data store
builtin functions instead
  FUNC(, 1, __CLC_GENTYPE, __local);
  ^
./generic/lib/shared/vstore.cl:80:42: note: expanded from macro 'FUNC'
#define FUNC(SUFFIX, VEC_SIZE, TYPE, AS) __FUNC(SUFFIX, VEC_SIZE, TYPE, AS)
                                         ^
./generic/lib/shared/vstore.cl:77:5: note: expanded from macro '__FUNC'
    VEC_STORE##VEC_SIZE(vec) \
    ^
<scratch space>:70:1: note: expanded from here
VEC_STORE1
^
./generic/lib/shared/vstore.cl:56:39: note: expanded from macro 'VEC_STORE1'
#define VEC_STORE1(val) mem[offset++] = val;
                                      ^
In file included from ./generic/lib/shared/vstore.cl:83:
In file included from ./generic/include/clc/math/gentype.inc:7:
./generic/lib/shared/vstore_half.inc:9:3: error: assigning directly to
pointer to type 'half' requires cl_khr_fp16. Use vector data store
builtin functions instead
  FUNC(, 1, __CLC_GENTYPE, __global);
  ^
./generic/lib/shared/vstore.cl:80:42: note: expanded from macro 'FUNC'
#define FUNC(SUFFIX, VEC_SIZE, TYPE, AS) __FUNC(SUFFIX, VEC_SIZE, TYPE, AS)
                                         ^
./generic/lib/shared/vstore.cl:77:5: note: expanded from macro '__FUNC'
    VEC_STORE##VEC_SIZE(vec) \
    ^
<scratch space>:70:1: note: expanded from here
VEC_STORE1
^
./generic/lib/shared/vstore.cl:56:39: note: expanded from macro 'VEC_STORE1'
#define VEC_STORE1(val) mem[offset++] = val;
                                      ^
In file included from ./generic/lib/shared/vstore.cl:83:
In file included from ./generic/include/clc/math/gentype.inc:15:
./generic/lib/shared/vstore_half.inc:3:3: error: assigning directly to
pointer to type 'half' requires cl_khr_fp16. Use vector data store
builtin functions instead
  FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __private);
  ^
./generic/lib/shared/vstore.cl:80:42: note: expanded from macro 'FUNC'
#define FUNC(SUFFIX, VEC_SIZE, TYPE, AS) __FUNC(SUFFIX, VEC_SIZE, TYPE, AS)
                                         ^
./generic/lib/shared/vstore.cl:77:5: note: expanded from macro '__FUNC'
    VEC_STORE##VEC_SIZE(vec) \
    ^
<scratch space>:70:1: note: expanded from here
VEC_STORE2
^
./generic/lib/shared/vstore.cl:58:2: note: expanded from macro 'VEC_STORE2'
        VEC_STORE1(val.lo) \
        ^
./generic/lib/shared/vstore.cl:56:39: note: expanded from macro 'VEC_STORE1'
#define VEC_STORE1(val) mem[offset++] = val;
                                      ^

Bug in Clang or libclcl?

Regards,
Vedran

I'd say it was introduced by
https://github.com/llvm-mirror/clang/commit/14ebecf1b1fe06e58d0e61b10a0
cabeb72878efe
https://reviews.llvm.org/D24626

I'm not sure what the correct fix is. We'd probably need to implement
_half version in llvm IR.

Jan