tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Patch for graphics/lcms2 (alignment issues on sparc)




> On Oct 31, 2026, at 4:38 PM, Taylor R Campbell <riastradh%NetBSD.org@localhost> wrote:
> 
> Maybe this should be alignof(max_align_t) instead?  I expect this
> affects more than just sparc32.

It could in principle: the default alignment is sizeof(void *), so any
32-bit platform that traps on a misaligned double would be exposed.
In practice I've only seen it on sparc; hppa (also ILP32 and
strict-alignment) does not hit it, so I don't want to claim more than
I've tested.

lcms2 only allocates doubles and 64-bit integers from the suballocator
and never uses long double, so 8 is enough everywhere.
alignof(max_align_t) would also work, but it's 16 on x86 and is C11,
while lcms2 still tries to build with pre-C99 compilers.

For pkgsrc I'd lean towards keeping the fix limited to sparc, since
that's where the failure is observed and tested. If people would rather
set -DCMS_PTR_ALIGNMENT=8 unconditionally, it's harmless (LP64 already
uses 8; ILP32 pays at most 4 bytes of padding per small allocation)
and I can change the patch.

Upstream declined the change (PR #635): the maintainer says SPARC is no
longer a supported platform and the build-time define is the intended
fix. So it will likely have to live in pkgsrc either way.


Home | Main Index | Thread Index | Old Index