Bug 26171 - #pragma omp threadprivate requires -funit-at-a-time
Summary: #pragma omp threadprivate requires -funit-at-a-time
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: monitored, openmp
Depends on:
Blocks:
 
Reported: 2006-02-08 10:47 UTC by Eric Botcazou
Modified: 2006-04-26 08:29 UTC (History)
3 users (show)

See Also:
Host: *-*-*
Target: *-*-*
Build: *-*-*
Known to work:
Known to fail:
Last reconfirmed: 2006-04-19 08:34:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Botcazou 2006-02-08 10:47:18 UTC
Try to compile libgomp/testsuite/libgomp.c/copyin-1.c at -O0:

eric@linux:~/build/gcc/native> gcc/xgcc -Bgcc -c copyin-1.c -I ~/build/gcc/native/x86_64-suse-linux/libgomp -fopenmp
/tmp/ccB3EieP.s: Assembler messages:
/tmp/ccB3EieP.s:278: Error: Accessing `thr' as thread-local object
/tmp/ccB3EieP.s:278: Error: Accessing `thr' as thread-local object
/tmp/ccB3EieP.s:278: Error: Accessing `thr' as thread-local object
/tmp/ccB3EieP.s:278: Error: Accessing `thr' as thread-local object
/tmp/ccB3EieP.s:278: Error: Accessing `thr' as thread-local object
/tmp/ccB3EieP.s:278: Error: Accessing `thr' as thread-local object

eric@linux:~/build/gcc/native> gcc/xgcc -Bgcc -c copyin-1.c -I ~/build/gcc/native/x86_64-suse-linux/libgomp -fopenmp -funit-at-a-time

eric@linux:~/build/gcc/native> gcc/xgcc -Bgcc -c copyin-1.c -I ~/build/gcc/native/x86_64-suse-linux/libgomp -fopenmp -O -fno-unit-at-a-time
/tmp/ccTYpCzg.s: Assembler messages:
/tmp/ccTYpCzg.s:220: Error: Accessing `thr' as thread-local object
/tmp/ccTYpCzg.s:220: Error: Accessing `thr' as thread-local object
/tmp/ccTYpCzg.s:220: Error: Accessing `thr' as thread-local object
/tmp/ccTYpCzg.s:220: Error: Accessing `thr' as thread-local object
/tmp/ccTYpCzg.s:220: Error: Accessing `thr' as thread-local object
/tmp/ccTYpCzg.s:220: Error: Accessing `thr' as thread-local object
Comment 1 Volker Reichelt 2006-02-22 15:10:22 UTC
Confirmed.
Even shorter testcase:

==================================
int i=0;
#pragma omp threadprivate (i)

void foo()
{
    i=0;
}
==================================
Comment 2 Jakub Jelinek 2006-04-26 08:26:15 UTC
Subject: Bug 26171

Author: jakub
Date: Wed Apr 26 08:26:06 2006
New Revision: 113271

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113271
Log:
	PR c/26171
	* cgraph.c (cgraph_varpool_finalize_decl): Don't call
	cgraph_varpool_assemble_pending_decls if -fopenmp, unless
	cgraph_global_info_ready.

	* testsuite/libgomp.c/pr26171.c: New test.

Added:
    trunk/libgomp/testsuite/libgomp.c/pr26171.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraph.c
    trunk/libgomp/ChangeLog

Comment 3 Jakub Jelinek 2006-04-26 08:29:15 UTC
Fixed in SVN.