The following code fragment fails on gcc i386 3.4.5-2, but works on 4.0.
Compilation terminates normally when field x is removed from structure 
declaration S.

The fragment is simple enough, but I could not find an open bug description for
it.





struct S
{
  char x;
  unsigned char v[2];
};

static __thread struct S G1;


void test_local (int i)
{
    (((unsigned char *) &G1.v)[i]) = ((unsigned char) 170U);
}


----------------------------------------------
$ uname -a
Linux 2.4.21-37.ELhugemem #1 SMP Sat Nov 26 12:13:22 EST 2005 i686 athlon i386
GNU/Linux

$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-49)

$ gcc x.c
x.c: In function `test_local':
x.c:17: unrecognizable insn:
(insn 9 17 11 (set (reg/f:SI 59)
        (const:SI (plus:SI (symbol_ref:SI ("%lG1"))
                (const_int 1 [0x1])))) -1 (nil)
    (expr_list:REG_EQUAL (const:SI (plus:SI (symbol_ref:SI ("%lG1"))
                (const_int 1 [0x1])))
        (nil)))
x.c:17: Internal compiler error in extract_insn, at recog.c:2149
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
Preprocessed source stored into /tmp/cc6v1K6v.out file, please attach this to
your bugreport.


----------------------------------------------
$ uname -a
Linux 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:54:53 EST 2006 i686 athlon i386
GNU/Linux

$ gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.5/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)

$ gcc x.c
x.c: In function `test_local':
x.c:17: error: unrecognizable insn:
(insn 8 15 9 0 (set (reg/f:SI 59)
        (const:SI (plus:SI (symbol_ref:SI ("G1") [flags 0x22] <var_decl
0xb7c69288 G1>)
                (const_int 1 [0x1])))) -1 (nil)
    (nil))
x.c:17: 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.


-- 
           Summary: use of thread local storage causes code generator to
                    fail
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: juulvanderspek at yahoo dot com


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

Reply via email to