~ chicken-core (chicken-5) b1aa804894bf53a78ed93a12d76276b2552f7d2b


commit b1aa804894bf53a78ed93a12d76276b2552f7d2b
Author:     Peter Bex <peter.bex@xs4all.nl>
AuthorDate: Tue Nov 26 21:44:53 2013 +0100
Commit:     Christian Kellermann <ckeen@pestilenz.org>
CommitDate: Fri Dec 6 10:02:11 2013 +0100

    Explicitly use signed chars for s8vector operations.
    
    This fixes the srfi-4 errors on PowerPC and ARM which were uncovered
    by tests which were recently added to compiler-tests.scm
    
    Signed-off-by: Christian Kellermann <ckeen@pestilenz.org>

diff --git a/NEWS b/NEWS
index 2f1e06d1..9c66c110 100644
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,8 @@
      use modules and forgot to require ports but use procedures from it.
   - Support has been added for the space-safe R7RS macro "delay-force".
   - Export file-type from the posix unit (thanks to Alan Post).
-  - unsetenv has been fixed on Windows
+  - unsetenv has been fixed on Windows.
+  - SRFI-4 s8vectors now work correctly in compiled code on PowerPC and ARM.
 
 - Platform support
   - CHICKEN can now be built on AIX (contributed by Erik Falor)
diff --git a/c-backend.scm b/c-backend.scm
index 17257e5e..1b5d0fc7 100644
--- a/c-backend.scm
+++ b/c-backend.scm
@@ -1172,7 +1172,7 @@
       [(c-string-list c-string-list*) "C_char **"]
       [(blob nonnull-blob u8vector nonnull-u8vector) (str "unsigned char *")]
       [(u16vector nonnull-u16vector) (str "unsigned short *")]
-      [(s8vector nonnull-s8vector) (str "char *")]
+      [(s8vector nonnull-s8vector) (str "signed char *")]
       [(u32vector nonnull-u32vector) (str "unsigned int *")]
       [(s16vector nonnull-s16vector) (str "short *")]
       [(s32vector nonnull-s32vector) (str "int *")]
diff --git a/chicken.h b/chicken.h
index bee2e37f..c25f6b8f 100644
--- a/chicken.h
+++ b/chicken.h
@@ -1099,8 +1099,8 @@ extern double trunc(double);
 #define C_srfi_4_vector(x)         C_data_pointer(C_block_item(x,1))
 #define C_c_u8vector(x)            ((unsigned char *)C_srfi_4_vector(x))
 #define C_c_u8vector_or_null(x)    ((unsigned char *)C_srfi_4_vector_or_null(x))
-#define C_c_s8vector(x)            ((char *)C_srfi_4_vector(x))
-#define C_c_s8vector_or_null(x)    ((char *)C_srfi_4_vector_or_null(x))
+#define C_c_s8vector(x)            ((signed char *)C_srfi_4_vector(x))
+#define C_c_s8vector_or_null(x)    ((signed char *)C_srfi_4_vector_or_null(x))
 #define C_c_u16vector(x)           ((unsigned short *)C_srfi_4_vector(x))
 #define C_c_u16vector_or_null(x)   ((unsigned short *)C_srfi_4_vector_or_null(x))
 #define C_c_s16vector(x)           ((short *)C_srfi_4_vector(x))
@@ -1537,7 +1537,7 @@ extern double trunc(double);
 #define C_ub_i_null_pointerp(p)         ((p) == NULL)
 
 #define C_ub_i_pointer_u8_ref(p)        (*((unsigned char *)(p)))
-#define C_ub_i_pointer_s8_ref(p)        (*((char *)(p)))
+#define C_ub_i_pointer_s8_ref(p)        (*((signed char *)(p)))
 #define C_ub_i_pointer_u16_ref(p)       (*((unsigned short *)(p)))
 #define C_ub_i_pointer_s16_ref(p)       (*((short *)(p)))
 #define C_ub_i_pointer_u32_ref(p)       (*((C_u32 *)(p)))
@@ -1545,7 +1545,7 @@ extern double trunc(double);
 #define C_ub_i_pointer_f32_ref(p)       (*((float *)(p)))
 #define C_ub_i_pointer_f64_ref(p)       (*((double *)(p)))
 #define C_ub_i_pointer_u8_set(p, n)     (*((unsigned char *)(p)) = (n))
-#define C_ub_i_pointer_s8_set(p, n)     (*((char *)(p)) = (n))
+#define C_ub_i_pointer_s8_set(p, n)     (*((signed char *)(p)) = (n))
 #define C_ub_i_pointer_u16_set(p, n)    (*((unsigned short *)(p)) = (n))
 #define C_ub_i_pointer_s16_set(p, n)    (*((short *)(p)) = (n))
 #define C_ub_i_pointer_u32_set(p, n)    (*((C_u32 *)(p)) = (n))
Trap