JonSnow1807 opened a new pull request, #1011: URL: https://github.com/apache/arrow-nanoarrow/pull/1011
Part of #950. The ArrowArrayView getters in `inline_array.h` read values, offsets and binary views through typed pointers, which is a misaligned load when a buffer from the C Data interface isn’t aligned. This adds `ArrowBufferViewGet*Unsafe()` helpers for the remaining fixed-width types next to the two from #946, uses them in the integer, double, string, bytes, list child offset and union child offset getters, and copies binary views before reading their fields. New tests read from buffers misaligned by 1 to 7 bytes in sliced arrays. On main UBSan reports 56 misaligned loads on 43 lines; with this change it reports none, and ctest passes under ASan and UBSan with clang and gcc. The helpers index the buffer as an array of byte arrays because with `i * sizeof(T)` clang stopped inlining `ArrowArrayViewGetIntUnsafe()` and `ArrowArrayViewGetDoubleUnsafe()` in files with more than one call site. With this form clang generates the same code as on main, and the array benchmarks are unchanged. The remaining sites (`array.c`, the IPC decoder, the C++ helpers) can follow separately. Code drafted by both human and AI, and reviewed by human. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
