Bug 44085 - OpenMP - untied task accesses threadprivate - non-conforming but no msg
Summary: OpenMP - untied task accesses threadprivate - non-conforming but no msg
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, openmp
Depends on:
Blocks:
 
Reported: 2010-05-11 18:20 UTC by Bill Long
Modified: 2010-05-12 14:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Long 2010-05-11 18:20:56 UTC
Test Case:

!  derived from OpenMP test omp3f/NF03_2_9_2_2a.f90
!  REFERENCES : OpenMP 3.0, p. 83, line 30
program NF03_2_9_2_2a
   implicit none
   integer, save :: threadprivate_var
!$omp threadprivate(threadprivate_var)

!$omp parallel
!$omp task untied
   threadprivate_var = 1
!$omp end task
!$omp end parallel

   print *, "FAIL - Negative test should not compile"
end program NF03_2_9_2_2a


> gfortran -fopenmp test.f90
> ./a.out
 FAIL - Negative test should not compile
>


Comments from OpenMP testers:

This test case is derived from OpenMP test omp3f/NF03_2_9_2_2a.f90 .
The negative test checks the following restriction:

The OpenMP API Version 3.0 (May 2008) states the following on p. 83 line 30:

" * A program in which an untied task accesses threadprivate storage
    is non-conforming."
Comment 1 Daniel Franke 2010-05-11 22:14:42 UTC
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
$> gfortran-4.4 -fopenmp pr44085.f90 &&./a.out 
 FAIL - Negative test should not compile

gcc version 4.5.1 20100509 (prerelease)
$> gfortran-4.5 -fopenmp pr44085.f90 &&./a.out 
 FAIL - Negative test should not compile

gcc version 4.6.0 20100510 (experimental)
$> gfortran-svn -fopenmp pr44085.f90 &&./a.out 
 FAIL - Negative test should not compile
Comment 2 Jakub Jelinek 2010-05-12 12:11:37 UTC
Subject: Bug 44085

Author: jakub
Date: Wed May 12 12:11:00 2010
New Revision: 159316

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159316
Log:
	PR middle-end/44085
	* gimplify.c (enum omp_region_type): Add ORT_UNTIED_TASK,
	change value of ORT_TASK.
	(new_omp_context): Handle ORT_UNTIED_TASK like ORT_TASK.
	(omp_notice_threadprivate_variable): New function.
	(omp_notice_variable): Call it for threadprivate variables.
	If enclosing ctx is a task, print enclosing task rather than
	enclosing parallel.  Handle ORT_UNTIED_TASK like ORT_TASK.
	(gimplify_omp_task): Pass ORT_UNTIED_TASK instead of ORT_TASK
	if task has untied clause.

	* gcc.dg/gomp/pr44085.c: New test.
	* gfortran.dg/gomp/pr44085.f90: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/gomp/pr44085.c
    trunk/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Jakub Jelinek 2010-05-12 12:19:10 UTC
Subject: Bug 44085

Author: jakub
Date: Wed May 12 12:18:55 2010
New Revision: 159317

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159317
Log:
	PR middle-end/44085
	* gimplify.c (enum omp_region_type): Add ORT_UNTIED_TASK,
	change value of ORT_TASK.
	(new_omp_context): Handle ORT_UNTIED_TASK like ORT_TASK.
	(omp_notice_threadprivate_variable): New function.
	(omp_notice_variable): Call it for threadprivate variables.
	If enclosing ctx is a task, print enclosing task rather than
	enclosing parallel.  Handle ORT_UNTIED_TASK like ORT_TASK.
	(gimplify_omp_task): Pass ORT_UNTIED_TASK instead of ORT_TASK
	if task has untied clause.

	* gcc.dg/gomp/pr44085.c: New test.
	* gfortran.dg/gomp/pr44085.f90: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/gomp/pr44085.c
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/gimplify.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2010-05-12 12:30:39 UTC
Subject: Bug 44085

Author: jakub
Date: Wed May 12 12:30:21 2010
New Revision: 159318

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159318
Log:
	PR middle-end/44085
	* gimplify.c (enum omp_region_type): Add ORT_UNTIED_TASK,
	change value of ORT_TASK.
	(new_omp_context): Handle ORT_UNTIED_TASK like ORT_TASK.
	(omp_notice_threadprivate_variable): New function.
	(omp_notice_variable): Call it for threadprivate variables.
	If enclosing ctx is a task, print enclosing task rather than
	enclosing parallel.  Handle ORT_UNTIED_TASK like ORT_TASK.
	(gimplify_omp_task): Pass ORT_UNTIED_TASK instead of ORT_TASK
	if task has untied clause.

	* gcc.dg/gomp/pr44085.c: New test.
	* gfortran.dg/gomp/pr44085.f90: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/gomp/pr44085.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/gimplify.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Comment 5 Jakub Jelinek 2010-05-12 14:39:54 UTC
Fixed.