OS:ubuntu 16.04
GPU:Quadro K2200
cuda toolkit version = 9.0, 9.1
the logical operator ‘||’ with vector variable will return a wrong result
int val = ANY_VAL;
int a = make_int2(10,2).y || val; // a is 2. Expect 1
int b = make_int2(10,0).y || val; // b is always 0. Expect a = 0 while val=0, otherwise 1;
the bug appears with respect to y,z,w (using make_int4), except x.
Thanks for the report.
The issue has been identified. It will be fixed in a future CUDA release, although it may not be the next public release of CUDA.
As a workaround, this suggestion: use a non-const temporary variable to store the vector value:
int2 tmp = make_int2(10,2);
int a = tmp.y || val;
int2 tmp2 = make_int2(10,0);
int b = tmp2.y || val;
This issue should be fixed in CUDA 10.0.130