This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Bugs in numbers.c (with patch)
- To: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Subject: Re: Bugs in numbers.c (with patch)
- From: "Greg J. Badros" <gjb at cs dot washington dot edu>
- Date: 22 Mar 2000 17:49:00 -0800
- Cc: Guile Mailing List <guile at sourceware dot cygnus dot com>
- References: <Pine.LNX.4.21.0003230001070.12383-100000@marvin.ida.ing.tu-bs.de>
Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:
> On Wed, 22 Mar 2000, Dirk Herrmann wrote:
>
> > On Wed, 22 Mar 2000, Dale P. Smith wrote:
> >
> > > SCM is now (void *). So it is unsigned. So (x < 0) will *never*
> > > return true. The compiler will probably just optimize away the tests.
> > > I would think it would be a good idea to go over all the code and
> > > check for places where a raw SCM value is compared < 0.
> > >
> > > The patch to numbers.h I'm not sure about, but I think it's right.
> >
> > Thanks for the patches. I have applied them.
>
> As we have learned by now, using void* is by far not sufficient to catch
> all misuses of SCM values. The operators ==, !=, <, <=, >, >=, +, -, ++,
> -- can be performed on pointers.
>
> Only looking for +, ++, -, --, <, <=, >, >=, !, I compiled guile with SCM
> typedef'd to union { struct { scm_bits_t n; } n; }. This resulted in the
<snip>
It'd be nice to have an easy #define to use to select your typedef
(strictly for bug-searching, not for generating the real executable --
the void * patch is a good middle ground for that for now).
Thanks,
Greg