bug-gnulib
[Top][All Lists]
Advanced

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

Re: obstack module has alignment issues on sparc? (Re: set_labels_identi


From: John Paul Adrian Glaubitz
Subject: Re: obstack module has alignment issues on sparc? (Re: set_labels_identifiers_target -fsanitize=undefined error)
Date: Tue, 14 Nov 2023 11:13:47 +0100
User-agent: Evolution 3.50.1

Hi Jeffrey!

On Tue, 2023-11-14 at 00:50 -0500, Jeffrey Walton wrote:
> On SPARC, 64-bit words can be loaded and saved through one of two
> instructions. The first version is optimized, the second version is
> not. The optimized version is faster, but the 64-bit words have to be
> aligned to 8-byte boundaries. I.e., naturally aligned.
> 
> If you are performing unaligned loads of 64-bit words, then you have
> to specify the compiler option -xmemalign=4i. -xmemalign=4i will
> generate the inefficient load, but it will avoid the SIGBUS.
> 
> When using the default toolchain settings, -xmemalign=8s is used,
> which causes the toolchain to use the optimized loads. I think that is
> what is generating the UBsan finding "runtime error: member access
> within misaligned address ... which requires 8 byte alignment."
> 
> Also see "3.4.151 –xmemalign[=<a><b>]",
> <https://docs.oracle.com/cd/E37069_01/html/E37076/aevkc.html>, in the
> Solaris manual.
> 
> > [1] 
> > https://www.gnu.org/software/libc/manual/html_node/Obstacks-Data-Alignment.html

This is completely new to me and really interesting, thanks for the heads-up!

However, I think this particular flag is not available in GCC or LLVM, is it?

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



reply via email to

[Prev in Thread] Current Thread [Next in Thread]