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

Bug#211610: gcc-3.3: Simple TLS code segfaults



Package: gcc-3.3
Version: 1:3.3.2-0pre3
Severity: normal
Tags: upstream


When trying to executing a binary with the __thread keywork, the program
segfaults. Below is the output.

[pts/0]
aroldan@volatile:~$ cat tls.c
__thread int a;

int 
main (void)
{
        return a;
}
[pts/0]
aroldan@volatile:~$ gcc-3.3 -Wall -o tls tls.c
[pts/0]
aroldan@volatile:~$ ./tls
Segmentation fault (core dumped)
[pts/0]
aroldan@volatile:~$ gdb tls core
GNU gdb 5.3.90_2003-08-24-cvs-debian
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...(no debugging symbols found)...
Core was generated by `./tls'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x08048344 in main ()
(gdb) disas main
Dump of assembler code for function main:
0x08048334 <main+0>:    push   %ebp
0x08048335 <main+1>:    mov    %esp,%ebp
0x08048337 <main+3>:    sub    $0x8,%esp
0x0804833a <main+6>:    and    $0xfffffff0,%esp
0x0804833d <main+9>:    mov    $0x0,%eax
0x08048342 <main+14>:   sub    %eax,%esp
0x08048344 <main+16>:   mov    %gs:0x0,%eax
0x0804834a <main+22>:   mov    0xfffffffc(%eax),%eax
0x08048350 <main+28>:   leave  
0x08048351 <main+29>:   ret    
0x08048352 <main+30>:   nop    
...
0x0804835f <main+43>:   nop    
End of assembler dump.
(gdb)

The segfault occurs on "return a;"

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux volatile 2.4.22-ck2 #1 mié sep 17 17:43:05 COT 2003 i686
Locale: LANG=es_ES, LC_CTYPE=es_ES (ignored: LC_ALL set to es_ES)

Versions of packages gcc-3.3 depends on:
ii  binutils                   2.14.90.0.6-1 The GNU assembler, linker and bina
ii  cpp-3.3                    1:3.3.2-0pre3 The GNU C preprocessor
ii  gcc-3.3-base               1:3.3.2-0pre3 The GNU Compiler Collection (base 
ii  libc6                      2.3.2-7       GNU C Library: Shared libraries an
ii  libgcc1                    1:3.3.2-0pre3 GCC support library

-- no debconf information




Reply to: