From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 26224 invoked from network); 13 Jul 1999 14:33:15 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 13 Jul 1999 14:33:15 -0000 Received: from mgw-x1.nokia.com (mgw-x1.nokia.com [131.228.20.21]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id KAA04568 for ; Tue, 13 Jul 1999 10:27:03 -0400 Received: from mgw-i1.ntc.nokia.com (mgw-i1.ntc.nokia.com [131.228.118.60]) by mgw-x1.nokia.com (8.9.3/8.9.3) with ESMTP id RAA13444 for ; Tue, 13 Jul 1999 17:26:58 +0300 (EETDST) Received: from ducati.uk.ntc.nokia.com (ducati.uk.ntc.nokia.com [131.228.132.169]) by mgw-i1.ntc.nokia.com (8.9.3/8.9.3) with SMTP id RAA15894 for ; Tue, 13 Jul 1999 17:26:57 +0300 (EETDST) Received: from mvagusta by ducati.uk.ntc.nokia.com (SMI-8.6/SMI-SVR4) id PAA23248; Tue, 13 Jul 1999 15:26:43 +0100 From: carmody@cpd.ntc.nokia.com (Phil Carmody) Received: (carmody@localhost) by mvagusta (SMI-8.6/8.6.9) id PAA19008; Tue, 13 Jul 1999 15:26:54 +0100 Date: Tue, 13 Jul 1999 15:26:54 +0100 Message-Id: <199907131426.PAA19008@mvagusta> To: axp-list@redhat.com In-reply-to: <378B1F63.1AEACAB0@frankfurt.netsurf.de> (Joachim.Wesner@frankfurt.netsurf.de) Subject: Re: an evil memcpy() optimizer bug! (egcs-1.1.2, alphaev6, linux) Mime-Version: 1.0 (generated by tm-edit 7.68) Content-Type: text/plain; charset=US-ASCII >>>>> "J" == EXT Joachim Wesner writes: J> Phil Carmody wrote: >> >> The 'YEP' paragraph has no connection to the ISO C language at all. >> >> There is no way an C coder can specify that a register be used for >> either a variable or a parameter. One may hint, or suggest, but not specify. >> It it the compiler's responsibility to ensure that anything one takes the >> address of has an address, and thus is not solely stored in a register. >> It was a bug, which is why it appears to have been fixed. Compilers, >> however, are permitted to keyhole optimise and convert known length calls >> to functions like memcpy into more efficient code. MSVC++ does this without >> even breaking into a sweat. J> Hu ??? OK, this is not really defined for arguments (and should work J> anyhow, probably with an warning, as I wrote before), but my copy of K&R J> says something like (Sorry, only have it in German, need to translate it J> back): J> The operator & can only be applied to variables and vector elements J> ...... Also, taking J> the adress of a variable of memory class register is illegal ! J> Maybe this has been changed in ISO C ?? Then, sorry for my ignorance. Nope, you are right. But the direction you are looking at the implication is different from mine. When the language definition says you cannot take the address of a register, it means that it is a semantic error on your part to try to take the address of an automatic variable declared as a register. It won't compile. However, it is a compiler error to not correctly provide the address of an auto variable, even if you've turned every optimisation under the sun on. (i.e. Compiler options about use of variables are very different from use of the keyword 'register') Phil