Skip to content

[C++] Enable alignment checks in UBSAN #35795

@westonpace

Description

@westonpace

Describe the enhancement requested

UBSAN is capable of detecting type punning a pointer when that pointer's address is not properly aligned. This is technically undefined behavior but it generally works on most modern processors. The exact comment (from 7 years ago 😲 ) is:

# - disable 'alignment' because unaligned access is really OK on Nehalem and we do it
#   all over the place.

However, based on the discussion in #35565 , it seems this is something we should be able to generally avoid and, by doing so, our code will be more tolerable on potentially niche processors.

As a result, we may want to consider enabling these alignment checks that we've always had disabled. A quick check shows that the following tests currently fail:

	  9 - arrow-tensor-test (Failed)
	 21 - arrow-compute-scalar-if-else-test (Failed)
	 25 - arrow-compute-vector-test (Failed)
	 67 - arrow-flight-test (Failed)
	 68 - arrow-flight-sql-test (Failed)
	 71 - arrow-ipc-read-write-test (Failed)

We should investigate the failures and fix the unaligned access. Or, if this is something unavoidable (flight, at the moment) or desirable (allowing unaligned access to IPC may be needed), then we can skip the test on UBSAN.

Component(s)

C++

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions