chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] Fix "char = signed char" assumption in C-based


From: Peter Bex
Subject: [Chicken-hackers] [PATCH] Fix "char = signed char" assumption in C-based s8vector operations
Date: Tue, 26 Nov 2013 21:57:46 +0100
User-agent: Mutt/1.4.2.3i

Hi all,

This was recently reported and I managed to reproduce it on my iBook.
The tests now crap out on compiler-tests.scm with the following message:

$ ./compiler-tests 
12
12
12
12
12
bar
1 2 3 
1 2 3 :1:2:3
1 2 3 
Good, unrepresentable C strings cause errors

Error: (compiler-tests.scm:275) assertion failed: (= -10 (s4v-sum "integer" 
s8vector (quote #s8(-1 -2 -3 -4))))

        Call history:

        compiler-tests.scm:232: =         
        compiler-tests.scm:269: u8vector-length   
        compiler-tests.scm:269: g758      
        compiler-tests.scm:270: u16vector-length          
        compiler-tests.scm:270: g775      
        compiler-tests.scm:271: u32vector-length          
        compiler-tests.scm:271: g792      
        compiler-tests.scm:272: u8vector-length   
        compiler-tests.scm:272: g809      
        compiler-tests.scm:273: u16vector-length          
        compiler-tests.scm:273: g824      
        compiler-tests.scm:274: u32vector-length          
        compiler-tests.scm:274: g839      
        compiler-tests.scm:275: s8vector-length   
        compiler-tests.scm:275: g854      
        compiler-tests.scm:275: ##sys#error             <--

This only happens on PowerPC and ARM (which have "char = unsigned char"),
and only recently started appearing due to commit
d3906e96adaf9dc24e6f514faf2e978810d516c8, which adds basic tests
for srfi-4 vectors (we didn't use to have any to speak of).

Since this is a long-standing and deeply-hidden bug, I think this
should go into stability as well.  It may need some patching due
to the other changes in d3906e96adaf9dc24e6f514faf2e978810d516c8
which modified the accessors.  Alternatively, we could just put
that patch into stability as well.  It's pretty trivial, and adds
the test which found the bug, after all!

Cheers,
Peter
-- 
http://www.more-magic.net

Attachment: 0001-Explicitly-use-signed-chars-for-s8vector-operations.patch
Description: Text document


reply via email to

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