This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

__thread and builtin memcpy() bug


filed as <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174061>

$ cat bug.c
#include <string.h>     /* memcpy() */

static
#ifdef SHOWBUG
__thread
#endif
int foo[2];

void
bug(void)
{
 int bar;

 (void) memcpy(&foo[0], &bar, sizeof(bar));
#ifdef SHOWBUG
 (void) memcpy(&foo[1], &bar, sizeof(bar));
#endif
}
$ gcc -g -O2 -c -DSHOWBUG  bug.c
bug.c: In function `bug':
bug.c:18: error: unrecognizable insn:
(insn:HI 15 14 17 0 bug.c:16 (set (reg/f:SI 64)
       (const:SI (plus:SI (symbol_ref:SI ("foo") [flags 0x22] <var_decl 0xb7ede1b0 foo>)
               (const_int 4 [0x4])))) -1 (nil)
   (nil))
bug.c:18: internal compiler error: in extract_insn, at recog.c:2083
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
$

- must use -O2 to see the bug
- -fno-builtin avoids the bug
- only shows up with 2 memcpy()'s in a row
- only shows up with __thread
- gcc-3.4.4-2.fc3
- the bug is quite reproducible, why does gcc say otherwise?

-frank


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]