public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23484] New: __builtin___memcpy_chk miscompilation
@ 2005-08-19 16:47 gbeauchesne at mandriva dot com
  2005-08-19 17:28 ` [Bug middle-end/23484] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gbeauchesne at mandriva dot com @ 2005-08-19 16:47 UTC (permalink / raw)
  To: gcc-bugs

Hi,

Compiling ruby on x86_64 with -D_FORTIFY_SOURCE=2 will cause failure in the
testsuite.

This can be reproduced with
GNU C version 4.1.0 20050819 (experimental) (x86_64-unknown-linux-gnu)

Here is a simplified testcase.

extern void abort (void);

#undef memcpy
#define memcpy(dst, src, len) \
  __builtin___memcpy_chk (dst, src, len, __builtin_object_size (dst, 0))

int
main (void)
{
  static const char data[] = { 0, 0x40, 0xe2, 0x01, 0x00, 0x01, 0x80, 0xc0, 0x1d };
  const char *s = &data[1];
  int natint = data[0];
  unsigned long tmp = 0;

  memcpy (&tmp, s, natint ? sizeof(tmp) : 4);
  if (sizeof(tmp) > 4 && (tmp >> 32) != 0) /* movq generated? */
    abort ();

  return 0;
}

-- 
           Summary: __builtin___memcpy_chk miscompilation
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gbeauchesne at mandriva dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23484


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-08-29 12:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-19 16:47 [Bug c/23484] New: __builtin___memcpy_chk miscompilation gbeauchesne at mandriva dot com
2005-08-19 17:28 ` [Bug middle-end/23484] " pinskia at gcc dot gnu dot org
2005-08-19 18:55 ` pinskia at gcc dot gnu dot org
2005-08-19 18:55 ` pinskia at gcc dot gnu dot org
2005-08-19 19:07 ` pinskia at gcc dot gnu dot org
2005-08-19 19:24 ` jakub at redhat dot com
2005-08-22 15:01 ` jakub at gcc dot gnu dot org
2005-08-29  8:42 ` cvs-commit at gcc dot gnu dot org
2005-08-29  8:50 ` cvs-commit at gcc dot gnu dot org
2005-08-29 12:41 ` pinskia at gcc dot gnu dot 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).