From: Gary Houston <ghouston@arglist.com>
Cc: cwitty@newtonlabs.com, hanwen@cs.uu.nl, guile-devel@gnu.org
Subject: Re: gcc optimisation breaks guile floating point
Date: 3 Oct 2002 00:34:09 +0100 [thread overview]
Message-ID: <200210022335.QAA18013@onyx.he.net> (raw)
In-Reply-To: <87bs6czcpz.fsf@zagadka.ping.de> (message from Marius Vollmer on 03 Oct 2002 00:40:24 +0200)
> Cc: cwitty@newtonlabs.com, hanwen@cs.uu.nl, guile-devel@gnu.org
> From: Marius Vollmer <mvo@zagadka.ping.de>
> Date: 03 Oct 2002 00:40:24 +0200
>
> Gary Houston <ghouston@arglist.com> writes:
>
> > > Under gcc, the following statement:
> > >
> > > asm volatile ("" : : : "memory");
> > >
> > > [...]
> >
> > This is good, it's similar to a previous work-around in libguile/throw.c.
>
> I haven't checked with the standard, but it might be the case that a
> compiler must assume that a pointer to char can alias any type. Thus,
>
> #define SCM_REAL_VALUE(x) (((scm_t_double *)((char *)SCM2PTR (x)))->real)
>
> might work as well.
I tried the extra cast on the simple test case, but it doesn't help.
In ANSI C any such assumption would be for void *, not char *, but
the pointer was void * already.
#include <stdlib.h>
#include <string.h>
static void * make_z (double x)
{
void *z = malloc (50);
memset (z, 0, 50);
*((unsigned long *) z) = 0;
*((double *) z) = x;
return z;
}
main ()
{
void *z = make_z (3.2);
double d = *((double *) z);
int i;
for (i = 0; i < sizeof (double); i++)
{
printf ("%d\n", ((unsigned char *) &d)[i]);
}
return 0;
}
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2002-10-02 23:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-27 21:10 gcc optimisation breaks guile floating point Gary Houston
2002-08-27 22:30 ` Han-Wen Nienhuys
2002-08-28 20:26 ` Marius Vollmer
2002-08-28 22:53 ` Han-Wen Nienhuys
2002-08-30 17:44 ` Gary Houston
2002-09-05 21:10 ` Han-Wen Nienhuys
2002-09-12 1:46 ` Carl R. Witty
2002-09-13 21:20 ` Han-Wen Nienhuys
2002-09-24 22:32 ` Gary Houston
[not found] ` <200209242233.PAA04201@onyx.he.net>
2002-10-02 22:40 ` Marius Vollmer
2002-10-02 23:34 ` Gary Houston [this message]
[not found] ` <200210022336.QAA18265@onyx.he.net>
2002-10-03 12:33 ` Marius Vollmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200210022335.QAA18013@onyx.he.net \
--to=ghouston@arglist.com \
--cc=cwitty@newtonlabs.com \
--cc=guile-devel@gnu.org \
--cc=hanwen@cs.uu.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).