Subject: lib/13370: gcc inlines memcpy(3)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <minoura@netbsd.org>
List: netbsd-bugs
Date: 07/04/2001 10:03:26
>Number: 13370
>Category: lib
>Synopsis: gcc inlines memcpy(3)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 03 18:01:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Minoura Makoto
>Release: 20010612
>Organization:
Minoura Makoto <minoura@netbsd.org>
The NetBSD Project/Japan NetBSD Users' Group
>Environment:
System: NetBSD daisy 1.5W NetBSD 1.5W (DAISY) #190: Mon Jun 25 14:28:07 JST 2001 root@daisy:/usr/obj/sys/arch/i386/compile/DAISY i386
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
Architecture: i386
Machine: i386
>Description:
gcc -O inlines the following memcpy(3) call (at least on i386):
#include <string.h>
extern char buf[];
void testfunc(char *src)
{
memcpy(buf, src, 100);
}
The inlined memcpy() gets insane when the two buffers are
overlapping.
On the other hand, memcpy(3) explicitly claims that our
implementation of memcpy() allows overlapping src and dst.
That is correct from the library developers but not from the
application developer's viewpoint.
>How-To-Repeat:
>Fix:
- Delete `bugs' section in memcpy(3)
- Or add note that gcc may inline memcpy().
>Release-Note:
>Audit-Trail:
>Unformatted: