From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13547 invoked by alias); 2 Dec 2012 17:16:49 -0000 Received: (qmail 13464 invoked by uid 48); 2 Dec 2012 17:16:30 -0000 From: "dje at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/55563] New: OpenMP not marking variable as thread-local Date: Sun, 02 Dec 2012 17:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dje at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg00098.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: dje@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) unit size align 32 symtab 0 alias set -1 canonical type 700153c0 precision 32 min max pointer_to_this > public static SI file copyin-1.c line 8 col 5 size unit size align 32 initial > $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.