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



             Bug #: 55563

           Summary: OpenMP not marking variable as thread-local

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: middle-end

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: d...@gcc.gnu.org





OpenMP threadprivate variables are not marked as thread-local at time when pool

storage is chosen. For example, libgomp.c/copyin-1.c



int thr = 32;

#pragma omp threadprivate (thr)



In varasm.c:use_blocks_for_decl_p(), the variable thread is marked as

TLS_MODEL_NONE



Breakpoint 2, _ZL21use_blocks_for_decl_pP9tree_node (decl=0x701634e0)

    at /nasfarm/dje/src/src/gcc/varasm.c:1116

1116      return targetm.use_blocks_for_decl_p (decl);

(gdb) print decl

$9 = (tree) 0x701634e0

(gdb) print debug_tree(decl)

 <var_decl 701634e0 thr

    type <integer_type 700153c0 int public SI

        size <integer_cst 700065e0 constant 32>

        unit size <integer_cst 70006600 constant 4>

        align 32 symtab 0 alias set -1 canonical type 700153c0 precision 32 min

<integer_cst 70006900 -2147483648> max <integer_cst 70006920 2147483647>

        pointer_to_this <pointer_type 70015ae0>>

    public static SI file copyin-1.c line 8 col 5 size <integer_cst 700065e0

32> unit size <integer_cst 70006600 4>

    align 32 initial <integer_cst 700f8660 32>>

$10 = 10

(gdb) print decl->decl_with_vis.tls_model

$11 = TLS_MODEL_NONE



This does not happen with variables declared with __thread, but does with

OpenMP and variables annotated using #pragma.



The variable later is transformed to TLS, but wrong choices have been made and

the now TLS variable is defined incorrectly in the assembly file.

Reply via email to