Opened 2 months ago

Last modified 2 months ago

#74191 new defect

Argyll 3.5.0 fails on M4max / Xcode CLT 26 --> workaround

Reported by: MStraeten (Martin Straeten) Owned by:
Priority: Low Milestone:
Component: ports Version: 2.12.5
Keywords: Cc:
Port: argyll

Description

On MacBook M4 Max, Xcode CLT 26 GenRMGam crashes with EXC_BAD_ACCESS during recursive tree traversal in radial_point_triang() (gamut.c around line 3989).

It seems to be triggered by compiler optimization (-Os / -O2).

Workaround: Lowering optimization to -O0 completely resolves the crash.

sudo port install argyll configure.optflags="-O0"

longterm solution: add

configure.optflags -O0

to the Portfile - but not sure, if that's appropriate when just one failing processor/sdk combination is known

Background (analysis by gemini): When optimization flags like -Os (optimize for size) or -O2 are active, the compiler makes aggressive assumptions about pointer arithmetic and memory layouts to make the machine code as compact and fast as possible.

In gamut.c — which heavily relies on complex tree structures and recursive quadtrees — the new Clang compiler erroneously optimizes away critical safety checks (such as if (np != NULL)) or miscalculates pointer offsets. It likely presumes certain memory states are "undefined behavior" or impossible. Because the M4 Max uses a massive, differently mapped virtual address space compared to older Intel or M1 chips, these bad compiler assumptions cause the pointers to jump to invalid addresses (e.g., jumping from 0x00000001... to 0x00000008...), triggering an immediate EXC_BAD_ACCESS crash.

Attachments (1)

main.log (305.7 KB) - added by MStraeten (Martin Straeten) 2 months ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 2 months ago by jmroot (Joshua Root)

Keywords: m4max xcode clt 26 removed
Milestone: MacPorts Future

If there's UB then the code needs to be fixed. Building with -fsanitize=address,undefined and seeing what output it produces would be informative. The crash report would also be helpful.

Last edited 2 months ago by jmroot (Joshua Root) (previous) (diff)

Changed 2 months ago by MStraeten (Martin Straeten)

Attachment: main.log added

comment:2 Changed 2 months ago by MStraeten (Martin Straeten)

got response from the author: issue in gamut.c will be fixed in next release, so until then this workaround might help in case ...

Note: See TracTickets for help on using tickets.