re PR middle-end/39573 (Linking fails on AMD with -march=native and -fopenmp, works with generic x86_64)

PR middle-end/39573
	* omp-low.c (expand_omp_taskreg): Finalize taskreg static local_decls
	variables.

	* libgomp.c++/pr39573.C: New test.

From-SVN: r145773
This commit is contained in:
Jakub Jelinek 2009-04-08 22:13:26 +02:00 committed by Jakub Jelinek
parent 8f82ce1eb0
commit 276c6b0f33
4 changed files with 58 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2009-04-08 Jakub Jelinek <jakub@redhat.com>
PR middle-end/39573
* omp-low.c (expand_omp_taskreg): Finalize taskreg static local_decls
variables.
2009-04-08 David Ayers <ayers@fsfe.org>
PR objc/27377

View File

@ -3409,6 +3409,14 @@ expand_omp_taskreg (struct omp_region *region)
/* Declare local variables needed in CHILD_CFUN. */
block = DECL_INITIAL (child_fn);
BLOCK_VARS (block) = list2chain (child_cfun->local_decls);
/* The gimplifier could record temporaries in parallel/task block
rather than in containing function's local_decls chain,
which would mean cgraph missed finalizing them. Do it now. */
for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
if (TREE_CODE (t) == VAR_DECL
&& TREE_STATIC (t)
&& !DECL_EXTERNAL (t))
varpool_finalize_decl (t);
DECL_SAVED_TREE (child_fn) = NULL;
gimple_set_body (child_fn, bb_seq (single_succ (entry_bb)));
TREE_USED (block) = 1;

View File

@ -1,3 +1,8 @@
2009-04-08 Jakub Jelinek <jakub@redhat.com>
PR middle-end/39573
* libgomp.c++/pr39573.C: New test.
2009-04-01 Jakub Jelinek <jakub@redhat.com>
PR other/39591

View File

@ -0,0 +1,39 @@
// PR middle-end/39573
// { dg-do run }
int z;
void __attribute__((noinline))
bar (int *x)
{
#pragma omp atomic
z += x[2];
x[2] += x[3];
}
int
main ()
{
int i;
#pragma omp parallel for
for (i = 0; i < 65536; i++)
{
int x[] =
{
0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1,
0, 0, 0, 1, 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