From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 12709 invoked from network); 12 Jul 1999 22:03:09 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 12 Jul 1999 22:03:09 -0000 Received: from beach.frankfurt.netsurf.de (root@beach.frankfurt.netsurf.de [194.64.181.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id RAA25674 for ; Mon, 12 Jul 1999 17:57:15 -0400 Received: from frankfurt.netsurf.de (n0-06-049.frankfurt.netsurf.de [194.195.95.49]) by beach.frankfurt.netsurf.de (8.8.5/8.8.5) with ESMTP id XAA22395 for ; Mon, 12 Jul 1999 23:57:12 +0200 (MET DST) Sender: fabwes@beach.frankfurt.netsurf.de Message-ID: <378A6429.B183164A@frankfurt.netsurf.de> Date: Mon, 12 Jul 1999 23:54:49 +0200 From: Joachim Wesner X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.36 i586) MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: an evil memcpy() optimizer bug! (egcs-1.1.2, alphaev6, linux) References: <378A21C6.1E094CB4@paralleldata.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 ??? Clearly, the above "problem" will not be so apparent on other not so RISCy architectures that anyhow pass doubles in memory/stack, because they are register starved (Intel ?), so I wouldn't blame it as an Alpha fault. Joachim