1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Eight byte align statically allocated stringbufs

Previously they were unaligned, unlike their parent strings, and so
could end up with the wrong pointer tag.  Observed on i686-linux-gnu,
where they ended up tagged as immediates (SCM_IMP()), causing failures
in TYP7 related checks.

* libguile/strings.h (SCM_IMMUTABLE_STRINGBUF): align resulting buffer
  via SCM_ALIGNED(8).
This commit is contained in:
Rob Browning 2024-11-28 13:01:01 -06:00
parent c78abcb765
commit 76afb429ee
2 changed files with 4 additions and 1 deletions

3
NEWS
View file

@ -49,6 +49,9 @@ arguments. The new syntax is documented in the Guile Reference manual.
(<https://bugs.gnu.org/72547>)
** Fix compilation with GCC 14 and musl on 32-bit systems
(<https://bugs.gnu.org/73835>)
** Immutable stringbufs are now 8-byte aligned on all systems
Previously they could end up with an alignment that violated the type
tag for their type (e.g. ending up tagged as immediates SCM_IMP()).
Changes in 3.0.10 (since 3.0.9)

View file

@ -184,7 +184,7 @@ SCM_API SCM scm_makfromstrs (int argc, char **argv);
#ifdef SCM_SUPPORT_STATIC_ALLOCATION
#define SCM_IMMUTABLE_STRINGBUF(c_name, contents) \
static SCM_UNUSED const \
static SCM_UNUSED SCM_ALIGNED(8) const \
struct \
{ \
scm_t_bits word_0; \