AblazeSpace

Weird OpenCL compiler behaviour using explicit casts between vector types

Discussion created by AblazeSpace on Jan 6, 2010
Latest reply on Jan 7, 2010 by genaganna

I found some weird ATI OpenCL compiler behaviour using "OpenCL 1.0 ATI-Stream-v2.0.0" ("CAL 1.4.515")

The following is working, but shouldn't according to the OpenCL 1.0 specification?
    float4 f;
    int4 i = (int4)(f);
(on NVIDIA OpenCL compiler "OpenCL 1.0 CUDA", "195.62", this will produce a compiler error... as expected)

From the OpenCL 1.0 specification: "http://www.khronos.org/registry/cl/specs/opencl-1.0.48.pdf" - "6.2.2 Explicit Casts"
    "
    Explicit casts between vector types are not legal. The example below will generate a compilation error.
    float4 f;
    int4 i = (int4) f; // -> not allowed
    "

Is this a bug or do I have overlooked anything?

By the way, the following works correctly according to the OpenCL 1.0 specification:
    float4 f;
    int4 i = (int4)f; // -> not working, but that's correct

And correct conversion:
    float4 f;
    int4 i = convert_int4(f);

Outcomes