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

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> 2011-11-03 18:22:05 
UTC ---
$ more ../gcc-live-trunk/libgomp/testsuite/libgomp.c++/pr24455-1.C 
// { dg-do compile }
// { dg-require-effective-target tls }
extern int i;
#pragma omp threadprivate (i)

int i;

===
if this is compiled with  "-x c "  we get:

$ more pr24455-1.s         .text
__GLOBAL__sub_I_65535_0_pr24455_1.C:
        pushl   %ebx
        subl    $24, %esp
        call    ___x86.get_pc_thunk.bx
L00000000001$pb:
        movl    $0, 12(%esp)
        movl    $4, 8(%esp)
        movl    $4, 4(%esp)
        movl    L___emutls_v.i$non_lazy_ptr-L00000000001$pb(%ebx), %eax
        movl    %eax, (%esp)
        call    ___emutls_register_common
        addl    $24, %esp
        popl    %ebx
        ret
        .mod_init_func
        .align 2
        .long   __GLOBAL__sub_I_65535_0_pr24455_1.C
        .comm   ___emutls_v.i,16,2
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
        .weak_definition        ___x86.get_pc_thunk.bx
        .private_extern ___x86.get_pc_thunk.bx
___x86.get_pc_thunk.bx:
        movl    (%esp), %ebx
        ret
        .section __IMPORT,__pointers,non_lazy_symbol_pointers
L___emutls_v.i$non_lazy_ptr:
        .indirect_symbol ___emutls_v.i
        .long   0
        .subsections_via_symbols

====

if compiled with g++ we get an empty body (as per comment #4).

the tree-dumps are not very interesting - because the tu shows as empty ...

I'm guessing that somehow g++ is dropping the extern .. which allows the
revised version of cgraphunit to prune the variable .. but I'm not sure how to
go about debugging this at the moment ...

Reply via email to