Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[BUG] reinterpret_cast is misused in many places in cuIO #6029
Comments
|
omg |
|
For the second one, since it was stated that it represents the This is the case where: int32_t data[5] = {};
schemadesc_s schema;
schema.data = reintepret_cast<void*>(data);
schema.type = type_int32;
// in the function context
auto dataptr = reinterpret_cast<uint8_t*>(schema.data);
reinterpret_cast<int32_t *>(dataptr)[row] = static_cast<int32_t>(v);
converting from |
Agreed. If it was left as |
|
@jrhemstad @vuule |
|
@vuule the changes have been merged, do let me know if you need any additional changes to be made |
|
Hi @lamarrr , there are actually many other places in |
|
Added the list of components so we can track progress more easily (since not all |
Yeah, sure! I'll try to help with some cleanups and push them within a day or two. |
|
Missed the "closes" tag in #6386. Reopening. |
|
Please note that most code that cooperatively loads structs uses |
There are (at least) two ways in which the
reinterpret_castis misused:static_cast:cudf/cpp/src/io/avro/avro_gpu.cu
Line 95 in f7fbc11
static cast should be used to cast from
void*.cudf/cpp/src/io/avro/avro_gpu.cu
Line 112 in f7fbc11
cudf/cpp/src/io/avro/avro_gpu.cu
Lines 131 to 132 in f7fbc11
These uses break the type aliasing rules as they cast between pointers to types that are not similar.
Proposed solution:
static_castwhere appropriate.hostdevice_buffertype might be beneficial here.std::memcpyinstead of the cast.TODO list of components: