public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45879] New: strcpy returns unexpected result
@ 2010-10-04 4:06 jachristini at gmail dot com
2010-10-04 4:16 ` [Bug c/45879] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: jachristini at gmail dot com @ 2010-10-04 4:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45879
Summary: strcpy returns unexpected result
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jachristini@gmail.com
This is my first bug report, I am not sure I have assigned the correct
category to this and whether this is actually a bug or change in philosophy.
My code was last compiled on GCC 4.1.2 and many other previous versions of
the GCC compilers over the last 8 years.
Are moving to a 64bit machine and this code that has worked for years, now
gives a strange result.
gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
--disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
A test case is as follows , built with gcc -osample sample.c
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
char data[20];
strcpy(data, "2010-1004");
strcpy(&data[4], &data[5]);
printf("%s\n", data);
return 0;
}
The expected return in data is "20101004", GCC 4.4.3 is returning "20101044"
I have no explanation for the unexpected result.
Thanks,
John
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-04 4:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-04 4:06 [Bug c/45879] New: strcpy returns unexpected result jachristini at gmail dot com
2010-10-04 4:16 ` [Bug c/45879] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).