From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 21630 invoked from network); 12 Jul 1999 23:12:13 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 12 Jul 1999 23:12:13 -0000 Received: from buster.bfr.co.il (root@morannon.bfr.co.il [192.116.142.129]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id TAA14418 for ; Mon, 12 Jul 1999 19:06:14 -0400 Received: from vermis.bfr.co.il (vermis.bfr.co.il [128.253.154.43]) by buster.bfr.co.il (8.8.5/8.8.5) with ESMTP id CAA19432 for ; Tue, 13 Jul 1999 02:06:08 +0300 Received: (from abel@localhost) by vermis.bfr.co.il (8.9.3/8.8.5) id AAA29649; Tue, 13 Jul 1999 00:27:27 +0300 Sender: abel@bfr.co.il To: axp-list@redhat.com Subject: Re: an evil memcpy() optimizer bug! (egcs-1.1.2, alphaev6, linux) References: <378A21C6.1E094CB4@paralleldata.com> <378A6429.B183164A@frankfurt.netsurf.de> Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII From: abel@bfr.co.il (Alexander L. Belikoff) Date: 13 Jul 1999 00:27:22 +0300 In-Reply-To: Joachim Wesner's message of "Mon, 12 Jul 1999 23:54:49 +0200" Message-ID: X-Mailer: Gnus v5.6.45/XEmacs 20.4 - "Emerald" Joachim Wesner writes: > Alexander L. Belikoff wrote: > > > > "Wes Bauske" writes: > > > > > Try modifying your code to pass the address of a double rather > > > than the double itself and see if you still can create the > > > problem. I've seen problems passing floats/doubles to functions > > > rather than their addresses. I just pass the address instead. > > > > As you may have noticed, I didn't talk about workaround - there are > > many of them. The one, I'm using now is that I have a temporary > > volatile double v2 in put_f8() and I copy v into v2 and use the > > latter. Other possible workarounds include, compiling put_f8() with > > optimization turned off (it is not time-critical), or using manual > > 'for' loop, rather than memcpy(). > > > > YEP, but actually I'd say this is a feature, not a bug ! If I remember > correctly written > somewhere in C standard, a temporary double arg, that will be passed in > a *register*, as you **will** like it to happen at maximum optimization, > simply has **NO** address to pass to memcpy. At best, the compiler can > warn you and automatically generate one of the above workarounds you > mention (with the SAME drawbacks), I don't think/expect there to exist a > compiler smart enough to replace your case with one single optimized > inline register to memory store or whatever. Or ??? Thank you for a very clear explanation. May I hope for a reference in the standard or the Steel book? This really starts to scare me now - what other surprises does the standard have? -- Alexander L. Belikoff Bloomberg L.P. / BFM Financial Research Ltd. abel@vallinor4.com, abel@bfr.co.il