guile-devel
[Top][All Lists]
Advanced

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

Re: gcc optimisation breaks guile floating point


From: Gary Houston
Subject: Re: gcc optimisation breaks guile floating point
Date: 30 Aug 2002 18:44:17 +0100

> From: Han-Wen Nienhuys <address@hidden>
> Date: Thu, 29 Aug 2002 00:53:57 +0200
> 
> > >   *((unsigned long *) z) = 0;
> > >   scm_remember ((SCM) z);
> > >   *((double *) z) = x;
> > >   return z;
> > 
> > I like this better (with a suitable comment of course).
> 
> In CVS.

Thanks, that's better:

guile> 3.2
3.2

However scm_double_cell itself probably needs to be fixed, otherwise
this problem will turn up again some day, or in user code (I'll look
at it myself if it's still a problem in a couple of weeks.)

> > I guess that the funny aliasing behaviour applies only to pointers to
> > floating point types, right?
> 
> I wouldn't be sure. It could happen with all sorts of initializations,
> I guess, but I'm not familiar enough with the source code to see which
> ones.

I've read that it happens whenever the types differ significantly,
e.g., int vs double or int vs struct both have the problem.  I wonder
if two different struct types would cause it, e.g., the old trick:

struct foo
{
  struct bar
  {
  }
  ...
}

with casting of pointers between foo and bar objects.





reply via email to

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