Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Richard Henderson <rth@dot.cygnus.com>
Subject: Re: axp/gcc the double cast gets trashed on return
Date: Mon, 6 Oct 1997 10:03:18 -0700	[thread overview]
Message-ID: <0175892354c15344f65d04d5599382c1.axp-list@archive.invalid> (raw)
In-Reply-To: <3438FA7E.E8FD1D28@voicenet.com>

On Mon, Oct 06, 1997 at 10:49:36AM -0400, Uncle George wrote:
> Hi,tell me why the double value returned from go_convert() is not 7.0???
> If u step through ( via gdb ) the val l.dd = 7, x.dd = 7,
> 
>     BUT d.dd is some bogus number. d.dd should have 7.0
> 
> Am I doing something wrong (u cannot change the code, unless there is a "C"
> violation somewhere!!!!)
[...]
>         l.ll = 0x401c000000000000;
>         d.dd = go_convert ( l.ll );

If you compile this with optimization, the compiler will elide the 
store to d.dd since (1) it is a local variable, thus there are no
side effects once the function is complete and (2) the value is not
used.

Make d global or static and you'll see it gets the right value.

r~

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

       reply	other threads:[~1997-10-06 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3438FA7E.E8FD1D28@voicenet.com>
1997-10-06 17:03 ` Richard Henderson [this message]
1997-10-07  0:08 ` axp/gcc the double cast gets trashed on return Volker Barthelmann
1997-10-06 18:35 Uncle George
  -- strict thread matches above, loose matches on Subject: below --
1997-10-06 14:49 Uncle George
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox