Your message dated Sun, 02 Oct 2005 16:45:54 +0200
with message-id <[EMAIL PROTECTED]>
and subject line Bug#325670: gcc-4.0: regression: generates wrong code for 
inlined memcpy
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 30 Aug 2005 07:34:03 +0000
>From [EMAIL PROTECTED] Tue Aug 30 00:34:03 2005
Return-path: <[EMAIL PROTECTED]>
Received: from dsl093-039-086.pdx1.dsl.speakeasy.net (tennyson.netexpress.net) 
[66.93.39.86] 
        by spohr.debian.org with esmtp (Exim 3.36 1 (Debian))
        id 1EA0d9-0008IV-00; Tue, 30 Aug 2005 00:34:03 -0700
Received: by tennyson.netexpress.net (Postfix, from userid 1003)
        id AF1D3704A; Tue, 30 Aug 2005 00:34:01 -0700 (PDT)
Date: Tue, 30 Aug 2005 00:34:01 -0700
From: Steve Langasek <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: gcc-4.0: regression: generates wrong code for inlined memcpy
Message-ID: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
        protocol="application/pgp-signature"; boundary="jho1yZJdad60DJr+"
Content-Disposition: inline
User-Agent: Mutt/1.5.9i
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-3.0 required=4.0 tests=BAYES_00 autolearn=no 
        version=2.60-bugs.debian.org_2005_01_02


--jho1yZJdad60DJr+
Content-Type: multipart/mixed; boundary="OgqxwSJOaUobr8KG"
Content-Disposition: inline


--OgqxwSJOaUobr8KG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Package: gcc-4.0
Version: 4.0.1-2
Severity: important

When passing pointers to 4-byte types to memcpy(), gcc-4.0 generates
wrong code which assumes that these pointers are aligned at 4-byte
boundaries for purposes of optimization, ignoring the implicit cast to
(char *) in the prototype of memcpy().  I don't believe code should have
to explicitly cast to (char *) to guard against such optimizations, and
it seems that memcpy() is quite likely to be used for copying data from
unaligned locations to aligned buffers precisely because it's supposed
to be capable of unaligned access.  At least two packages, dhcp3 and
traceroute, have been reported as failing on sparc with bus errors when
built with gcc-4.0, because they use memcpy() to copy data from network
buffers where alignment is not guaranteed.

This bug has been reproduced with gcc-4.0 4.0.1-6 on vore using the
attached test case.  The test case is derived from the failing code in
dhcp3 (bug #321987, #325605).

[EMAIL PROTECTED]:~$ gcc-4.0 -g -o memcpytest ./memcpytest.c  && ./memcpytest
Bus error
[EMAIL PROTECTED]:~$ gcc-4.0 -DEXPLICIT_CAST -g -o memcpytest ./memcpytest.c && 
.=
/memcpytest
[EMAIL PROTECTED]:~$

Thanks,
--=20
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
[EMAIL PROTECTED]                                   http://www.debian.org/

--OgqxwSJOaUobr8KG
Content-Type: text/x-csrc; charset=us-ascii
Content-Disposition: attachment; filename="memcpytest.c"

#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>

int main() {
        unsigned char buf[512];
        unsigned bufix = 14;
        struct sockaddr_in from;
        struct sockaddr_in *src = (struct sockaddr_in *)(buf+bufix);

#ifdef EXPLICIT_CAST
        memcpy (&from.sin_addr, (char *)&src->sin_addr, 4);
#else
        memcpy (&from.sin_addr, &src->sin_addr, 4);
#endif

        exit(0);
}

--OgqxwSJOaUobr8KG--

--jho1yZJdad60DJr+
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDFAvpKN6ufymYLloRAlr0AKCrQnpxM5yZwQkgsbgUQsNu3b6I0gCgyE61
8/64ABjwai114ofSsAnyi/4=
=olG0
-----END PGP SIGNATURE-----

--jho1yZJdad60DJr+--

---------------------------------------
Received: (at 325670-done) by bugs.debian.org; 2 Oct 2005 14:46:25 +0000
>From [EMAIL PROTECTED] Sun Oct 02 07:46:25 2005
Return-path: <[EMAIL PROTECTED]>
Received: from smtp05.web.de [217.72.192.209] 
        by spohr.debian.org with esmtp (Exim 3.36 1 (Debian))
        id 1EM56f-0007ko-00; Sun, 02 Oct 2005 07:46:25 -0700
Received: from [84.59.228.175] (helo=juist)
        by smtp05.web.de with asmtp (TLSv1:DES-CBC3-SHA:168)
        (WEB.DE 4.105 #317)
        id 1EM56A-0004ed-00
        for [EMAIL PROTECTED]; Sun, 02 Oct 2005 16:45:54 +0200
Received: from falk by juist with local (Exim 4.53)
        id 1EM56A-0004YV-Bf
        for [EMAIL PROTECTED]; Sun, 02 Oct 2005 16:45:54 +0200
To: [EMAIL PROTECTED]
Subject: Bug#325670: gcc-4.0: regression: generates wrong code for inlined
 memcpy
From: Falk Hueffner <[EMAIL PROTECTED]>
X-Face: "iUeUu$b*W_"w?tV83Y3*r:`rh&dRv}$YnZ3,LVeCZSYVuf[Gpo*5%_=/\_!gc_,SS}[~xZ
 wY77I-M)xHIx:2f56g%/`SOw"Dx%4Xq0&f\Tj~>|QR|vGlU}TBYhiG(K:2<T^
Date: Sun, 02 Oct 2005 16:45:54 +0200
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (cilantro, linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Sender: [EMAIL PROTECTED]
X-Sender: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02

Hi,

consensus seems to be that his is not a bug in gcc, so closing.

-- 
        Falk


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to