guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] branch main updated: Eight byte align statically allocat


From: Rob Browning
Subject: [Guile-commits] branch main updated: Eight byte align statically allocated stringbufs
Date: Fri, 29 Nov 2024 13:37:54 -0500

This is an automated email from the git hooks/post-receive script.

rlb pushed a commit to branch main
in repository guile.

The following commit(s) were added to refs/heads/main by this push:
     new 76afb429e Eight byte align statically allocated stringbufs
76afb429e is described below

commit 76afb429ee7a8a4c9eddb20bf29a2246192f8a28
Author: Rob Browning <rlb@defaultvalue.org>
AuthorDate: Thu Nov 28 13:01:01 2024 -0600

    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).
---
 NEWS               | 3 +++
 libguile/strings.h | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index e910addb1..c86426cde 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
diff --git a/libguile/strings.h b/libguile/strings.h
index f28ef3246..d417514f8 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -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;                                 \



reply via email to

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