Subject: bug#76393: Warn about -fsanitizer=address builds

From: Eli Zaretskii <[email-masked]>
Date: Tue, 18 Feb 2025 21:35:23 +0200

> Date: Tue, 18 Feb 2025 17:24:26 +0000
> From: Pip Cet <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> "Eli Zaretskii" <[email-masked]> writes:
> 
> > When you say "bugs in compiled code", do you mean the code in the
> > Emacs executable, or do you mean the bytecode or native code emitted
> 
> The code put by GCC -fanalyzer into the Emacs executable does buggy
> things unless an environment variable is set to make it not do those
> things.
> 
> > by compiling Lisp?  If the former, isn't that a GCC bug?  And if so,
> 
> It is, yes: GCC violates the unwritten contract by which conservative GC
> works when compiling with -fanalyze=address, by moving stack structs to the
> heap.
> 
> > perhaps there are some -fSOMETHING switches which avoid hitting those
> > bugs?
> 
> -fno-analyze=address?  Ideally, GCC should be passed by Emacs an option
> to ensure it won't break conservative GC, but I'm not aware of such an
> option.

I'm not familiar with -fanalyze=address.  Does disabling it still
allow to use address sanitization? if so, perhaps we should recommend
using -fno-analyze=address when building for ASAN?