[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#647084: libc6-dev: strcpy and others improperly inlined, turns them into infinite loops



Package: libc6-dev
Version: 2.13-21
Severity: important

Compiling the following with gcc -std=c99 -Os -D_FORTIFY_SOURCE=2 results in a
binary that hangs in an infinite loop in strcpy():

#include <argp.h>
#include <string.h>

int main (void) {
    char buf[1024];
    char* str = "hello";
    strcpy (buf, str);
    return 0;
}

The argp.h include then causes the following definition for strcpy:
extern __inline char *
 strcpy (char *__restrict __dest, const char *__restrict __src)
{
   return __builtin___strcpy_chk (__dest, __src, __builtin_object_size (__dest,
   2 > 1));
}
....which is incorrect according to the gcc guys:
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-30 09:12:28 UTC ---
>extern __inline char *
> strcpy (char *__restrict __dest, const char *__restrict __src)
>
> this should be marked with __attribute__((gnu_inline)), otherwise
> it won't work with -std=c99.  GCC fix-includes glibc headers for this,
> so this is a packaging bug on the debian side, please file it there.
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50916)

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (600, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.0.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6-dev depends on:
ii  libc-dev-bin    2.13-21
ii  libc6           2.13-21
ii  linux-libc-dev  3.0.0-5

Versions of packages libc6-dev recommends:
ii  gcc [c-compiler]      4:4.6.1-3
ii  gcc-4.4 [c-compiler]  4.4.6-11 
ii  gcc-4.5 [c-compiler]  4.5.3-9  
ii  gcc-4.6 [c-compiler]  4.6.2-2  

Versions of packages libc6-dev suggests:
ii  glibc-doc     <none>  
ii  manpages-dev  3.32-0.2

-- no debconf information



Reply to: