Re: [PATCH] use memcmp in page_extensible_p for well-defined type+gen comparison

Hayley Patton <[email protected]> Fri, 27 Feb 2026 16:36:19 +1100
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <[email protected]>
On 27/2/26 13:32, Andreas Franke via Sbcl-devel wrote:
>> - This is identical codegen to the original *(int16_t*) cast, but without undefined behavior
>>
>> The only theoretical risk would be if some exotic compiler didn't inline memcmp of 2 bytes — but at -O3 both GCC and Clang do, and SBCL doesn't build at anything lower.

I'm quite confident it's still UB to access &page_table[index].gen via 
going off the bounds of &page_table[index].type, but it isn't any *more* 
UB than casting to (int16_t*).
And SBCL definitely does build on -O0, but no one would be bothered if 
memcmp gets inlined or not if they build with -O0. Who wrote this 
explanation?

To elaborate on my last email -- while I think this patch itself is okay 
-- I don't like the idea of LLM-generating runtime code in the 
slightest, because the runtime is exceedingly prone to Heisenbugs, and 
LLMs have a habit of making up dubious explanations for their doings.



_______________________________________________
Sbcl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-devel