https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108404
Bug ID: 108404 Summary: M2RTS_Halt fails with a segv (it should emit a diagnostic and exit). Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: modula2 Assignee: gaius at gcc dot gnu.org Reporter: iains at gcc dot gnu.org Target Milestone: --- On Darwin several tests fail because there is an invalid stack size set (that is a separate bug). The fault should have been reported by M2RTS_Halt (it is detected correctly in Rico.cc). Setting a break point on the entry to M2RTS_Halt : * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x00000001000054f0 concurrentstore.x0`M2RTS_Halt at M2RTS.mod:296:1 293 294 PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL; 295 function: ARRAY OF CHAR; description: ARRAY OF CHAR) ; -> 296 BEGIN 297 ErrorMessage (description, file, line, function) ; 298 HALT 299 END Halt ; examining the registers: (lldb) reg read General Purpose Registers: rax = 0x0000000000000016 rbx = 0x0000600002c08118 rcx = 0x0000000100014c00 "failed to set stack size attribute" rdx = 0x0000000100014bf2 "initThread" rdi = 0x0000000100014b00 "/src-local/gcc-master/libgm2/libm2iso/RTco.cc" rsi = 0x0000000000000172 this is correct ABI - RDI - file, RSI = line number, RDX = function, RCX = message. (four integer/pointer arguments). ---- however if we continue from this point ... * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x3014e7178) frame #0: 0x000000010000554f concurrentstore.x0`M2RTS_Halt at M2RTS.mod:296:1 293 294 PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL; 295 function: ARRAY OF CHAR; description: ARRAY OF CHAR) ; -> 296 BEGIN 297 ErrorMessage (description, file, line, function) ; I cannot (at present) debug this further since I do not have an installed debugger that supports Module-2 (but it might well repeat on Linux - the ABI is basically the same). In any case, it seems likely that the problem is in the prologue or very early in the function since the break line is on BEGIN in both cases.