Rainer Orth schrieb:
> Georg-Johann Lay <a...@gjlay.de> writes:
> 
>> The auto-detect machinery fails to correctly detect that TLS is not supported
>> on AVR.  This leads to gross noise of several hundreds of FAILs in testsuite.
>>
>> This patch explicitly tells that AVR doesn't support TLS.
>>
>> Lightly tested with testsuite run on avr-unknown-none where tests like
>> gcc.dg/debug/tls-1.c ran into ICE are UNSUPPORTED now.
> 
> This seems wrong: all targets not supporting native TLS fall back to
> emutls and pass the tests just fine.  You should investigate what's
> happening on AVR instead of papering over the problem.
> 
>       Rainer

For example, after updating trunk to 179738,




(gdb) set args  -fpreprocessed tls-1.i -quiet -dumpbase tls-1.c -mmcu=atmega128
-auxbase tls-1 -gdwarf-2 -O3 -O2 -version -o tls-1.s
(gdb) cd ~/test
(gdb) r
GNU C (GCC) version 4.7.0 20111010 (experimental) (avr)
        compiled by GNU C version 4.3.2 [gcc-4_3-branch revision 141291], GMP
version 5.0.1, MPFR version 3.0.0-p8, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C (GCC) version 4.7.0 20111010 (experimental) (avr)
        compiled by GNU C version 4.3.2 [gcc-4_3-branch revision 141291], GMP 
version
5.0.1, MPFR version 3.0.0-p8, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 4e4900df2fe6cd3a5bd440dbb3a30bf2

Program received signal SIGSEGV, Segmentation fault.
0x0864e398 in set_is_used (var=0xb7dd3600) at
../../../gcc.gnu.org/trunk/gcc/tree-flow-inline.h:562
(gdb) bt
#0  0x0864e398 in set_is_used (var=0xb7dd3600) at
../../../gcc.gnu.org/trunk/gcc/tree-flow-inline.h:562
#1  0x0864e256 in mark_all_vars_used_1 (tp=0xb7dc97c4,
walk_subtrees=0xbfffe004, data=0x0) at
../../../gcc.gnu.org/trunk/gcc/tree-ssa-live.c:379
#2  0x087c69b6 in walk_tree_1 ()
#3  0x0864f37c in mark_all_vars_used (expr_p=0xb7dd24e0, data=0x0) at
../../../gcc.gnu.org/trunk/gcc/tree-ssa-live.c:595
#4  0x0864fd71 in remove_unused_locals () at
../../../gcc.gnu.org/trunk/gcc/tree-ssa-live.c:727
#5  0x08492d5d in execute_function_todo (data=0x8000) at
../../../gcc.gnu.org/trunk/gcc/passes.c:1695
#6  0x08492e6c in do_per_function (callback=0x8492bf0 <execute_function_todo>,
data=0x8000) at ../../../gcc.gnu.org/trunk/gcc/passes.c:1548
#7  0x08492fad in execute_todo (flags=32768) at
../../../gcc.gnu.org/trunk/gcc/passes.c:1741
#8  0x08493e9a in execute_one_pass (pass=0x8b98560) at
../../../gcc.gnu.org/trunk/gcc/passes.c:2087
#9  0x0849419d in execute_pass_list (pass=0x8b98560) at
../../../gcc.gnu.org/trunk/gcc/passes.c:2119
#10 0x085d3461 in tree_rest_of_compilation (fndecl=0xb7dca500) at
../../../gcc.gnu.org/trunk/gcc/tree-optimize.c:420
#11 0x08202f4a in cgraph_expand_function (node=0xb7dcb09c) at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1805
#12 0x08203f61 in cgraph_optimize () at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1864
#13 0x08205325 in cgraph_finalize_compilation_unit () at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1312
#14 0x080bb5b8 in c_write_global_declarations () at
../../../gcc.gnu.org/trunk/gcc/c-decl.c:9936
#15 0x08565cce in toplev_main (argc=15, argv=0xbfffe5d4) at
../../../gcc.gnu.org/trunk/gcc/toplev.c:581
#16 0x0816cc02 in main (argc=-1210281312, argv=0xb7dd1070) at
../../../gcc.gnu.org/trunk/gcc/main.c:36
(gdb) frame 1
#1  0x0864e256 in mark_all_vars_used_1 (tp=0xb7dc97c4,
walk_subtrees=0xbfffe004, data=0x0) at
../../../gcc.gnu.org/trunk/gcc/tree-ssa-live.c:379
(gdb) p t
$1 = (tree) 0xb7dd3600
(gdb) pt
 <var_decl 0xb7dd3600 __emutls_v.vara
    type <record_type 0xb7dd35a0 __emutls_object BLK
        size <integer_cst 0xb7d95f28 constant 48>
        unit size <integer_cst 0xb7d95f00 constant 6>
        align 8 symtab 0 alias set -1 canonical type 0xb7dd35a0
        fields <field_decl 0xb7d597e8 __size type <integer_type 0xb7d5d1e0
unsigned char>
            unsigned QI file (null) line 0 col 0
            size <integer_cst 0xb7d4e1cc constant 8>
            unit size <integer_cst 0xb7d4e1e0 constant 1>
            align 8 offset_align 8
            offset <integer_cst 0xb7d4e0b4 constant 0>
            bit offset <integer_cst 0xb7d4e118 constant 0> context <record_type
0xb7dd35a0 __emutls_object> chain <field_decl 0xb7d5978c __align>>
        pointer_to_this <pointer_type 0xb7dd36c0>>
    addressable used static ignored BLK file
/mnt/nfs/home/georg/gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.dg/debug/tls-1.c
line 7 col 21 size <integer_cst 0xb7d95f28 48> unit size <integer_cst 
0xb7d95f00 6>
    align 8 context <translation_unit_decl 0xb7d65d80 D.1228> initial
<constructor 0xb7d8bd10>>
(gdb) frame 0
#0  0x0864e398 in set_is_used (var=0xb7dd3600) at
../../../gcc.gnu.org/trunk/gcc/tree-flow-inline.h:562
(gdb) p ann
$2 = (var_ann_t) 0x0
(gdb)

So there is a NULL pointer dereference.

Reply via email to