From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <0175892354c15344f65d04d5599382c1.axp-list@archive.invalid> X-Archive-Original-Message-ID: <3.0.2.32.19971006100055.007ef100@bertie.usfca.edu> Date: Mon, 6 Oct 1997 10:03:18 -0700 From: Richard Henderson Subject: Re: axp/gcc the double cast gets trashed on return 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