re PR fortran/44536 (OMP: missing error with default(none))

PR fortran/44536
	* langhooks.h (struct lang_hooks_for_decls): Add omp_report_decl.
	* langhooks-def.h (LANG_HOOKS_OMP_REPORT_DECL): Define.
	(LANG_HOOKS_DECLS): Add it.
	* gimplify.c (omp_notice_variable): Call
	lang_hooks.decls.omp_report_decl.

	* trans-openmp.c (gfc_omp_predetermined_sharing): Don't return
	OMP_CLAUSE_DEFAULT_SHARED for artificial vars with
	GFC_DECL_SAVED_DESCRIPTOR set.
	(gfc_omp_report_decl): New function.
	* trans.h (gfc_omp_report_decl): New prototype.
	* f95-lang.c (LANG_HOOKS_OMP_REPORT_DECL): Redefine.

	* gfortran.dg/gomp/pr44536.f90: New test.
	* gfortran.dg/gomp/sharing-3.f90: Remove xfail.

From-SVN: r160783
This commit is contained in:
Jakub Jelinek 2010-06-15 14:27:01 +02:00 committed by Jakub Jelinek
parent 78b31ae62c
commit 94ea129639
11 changed files with 64 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2010-06-15 Jakub Jelinek <jakub@redhat.com>
PR fortran/44536
* langhooks.h (struct lang_hooks_for_decls): Add omp_report_decl.
* langhooks-def.h (LANG_HOOKS_OMP_REPORT_DECL): Define.
(LANG_HOOKS_DECLS): Add it.
* gimplify.c (omp_notice_variable): Call
lang_hooks.decls.omp_report_decl.
2010-06-14 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline

View File

@ -1,3 +1,13 @@
2010-06-15 Jakub Jelinek <jakub@redhat.com>
PR fortran/44536
* trans-openmp.c (gfc_omp_predetermined_sharing): Don't return
OMP_CLAUSE_DEFAULT_SHARED for artificial vars with
GFC_DECL_SAVED_DESCRIPTOR set.
(gfc_omp_report_decl): New function.
* trans.h (gfc_omp_report_decl): New prototype.
* f95-lang.c (LANG_HOOKS_OMP_REPORT_DECL): Redefine.
2010-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
* fortran/intrinsic.c (add_functions): Change gfc_check_btest,

View File

@ -116,6 +116,7 @@ static void gfc_init_ts (void);
#undef LANG_HOOKS_INIT_TS
#undef LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE
#undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
#undef LANG_HOOKS_OMP_REPORT_DECL
#undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR
#undef LANG_HOOKS_OMP_CLAUSE_COPY_CTOR
#undef LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP
@ -143,6 +144,7 @@ static void gfc_init_ts (void);
#define LANG_HOOKS_INIT_TS gfc_init_ts
#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE gfc_omp_privatize_by_reference
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING gfc_omp_predetermined_sharing
#define LANG_HOOKS_OMP_REPORT_DECL gfc_omp_report_decl
#define LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR gfc_omp_clause_default_ctor
#define LANG_HOOKS_OMP_CLAUSE_COPY_CTOR gfc_omp_clause_copy_ctor
#define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP gfc_omp_clause_assign_op

View File

@ -75,7 +75,10 @@ gfc_omp_privatize_by_reference (const_tree decl)
enum omp_clause_default_kind
gfc_omp_predetermined_sharing (tree decl)
{
if (DECL_ARTIFICIAL (decl) && ! GFC_DECL_RESULT (decl))
if (DECL_ARTIFICIAL (decl)
&& ! GFC_DECL_RESULT (decl)
&& ! (DECL_LANG_SPECIFIC (decl)
&& GFC_DECL_SAVED_DESCRIPTOR (decl)))
return OMP_CLAUSE_DEFAULT_SHARED;
/* Cray pointees shouldn't be listed in any clauses and should be
@ -118,6 +121,19 @@ gfc_omp_predetermined_sharing (tree decl)
return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
}
/* Return decl that should be used when reporting DEFAULT(NONE)
diagnostics. */
tree
gfc_omp_report_decl (tree decl)
{
if (DECL_ARTIFICIAL (decl)
&& DECL_LANG_SPECIFIC (decl)
&& GFC_DECL_SAVED_DESCRIPTOR (decl))
return GFC_DECL_SAVED_DESCRIPTOR (decl);
return decl;
}
/* Return true if DECL in private clause needs
OMP_CLAUSE_PRIVATE_OUTER_REF on the private clause. */

View File

@ -508,6 +508,7 @@ bool gfc_get_array_descr_info (const_tree, struct array_descr_info *);
/* In trans-openmp.c */
bool gfc_omp_privatize_by_reference (const_tree);
enum omp_clause_default_kind gfc_omp_predetermined_sharing (tree);
tree gfc_omp_report_decl (tree);
tree gfc_omp_clause_default_ctor (tree, tree, tree);
tree gfc_omp_clause_copy_ctor (tree, tree, tree);
tree gfc_omp_clause_assign_op (tree, tree, tree);

View File

@ -5369,7 +5369,8 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
{
case OMP_CLAUSE_DEFAULT_NONE:
error ("%qs not specified in enclosing parallel",
IDENTIFIER_POINTER (DECL_NAME (decl)));
IDENTIFIER_POINTER (DECL_NAME
(lang_hooks.decls.omp_report_decl (decl))));
if ((ctx->region_type & ORT_TASK) != 0)
error ("%Henclosing task", &ctx->location);
else

View File

@ -195,6 +195,7 @@ extern tree lhd_make_node (enum tree_code);
#define LANG_HOOKS_COMDAT_GROUP lhd_comdat_group
#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_const_tree_false
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING lhd_omp_predetermined_sharing
#define LANG_HOOKS_OMP_REPORT_DECL lhd_pass_through_t
#define LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR hook_bool_tree_bool_false
#define LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE hook_bool_tree_bool_false
#define LANG_HOOKS_OMP_PRIVATE_OUTER_REF hook_bool_tree_false
@ -214,6 +215,7 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_COMDAT_GROUP, \
LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE, \
LANG_HOOKS_OMP_PREDETERMINED_SHARING, \
LANG_HOOKS_OMP_REPORT_DECL, \
LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR, \
LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE, \
LANG_HOOKS_OMP_PRIVATE_OUTER_REF, \

View File

@ -187,6 +187,10 @@ struct lang_hooks_for_decls
predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise. */
enum omp_clause_default_kind (*omp_predetermined_sharing) (tree);
/* Return decl that should be reported for DEFAULT(NONE) failure
diagnostics. Usually the DECL passed in. */
tree (*omp_report_decl) (tree);
/* Return true if DECL's DECL_VALUE_EXPR (if any) should be
disregarded in OpenMP construct, because it is going to be
remapped during OpenMP lowering. SHARED is true if DECL

View File

@ -1,3 +1,9 @@
2010-06-15 Jakub Jelinek <jakub@redhat.com>
PR fortran/44536
* gfortran.dg/gomp/pr44536.f90: New test.
* gfortran.dg/gomp/sharing-3.f90: Remove xfail.
2010-06-14 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline

View File

@ -0,0 +1,10 @@
! PR fortran/44536
! { dg-do compile }
! { dg-options "-fopenmp" }
subroutine foo (a, i, j)
integer, dimension(:) :: a
integer :: i, j
!$omp parallel default(none) shared(i, j) ! { dg-error "enclosing parallel" }
j=a(i) ! { dg-error "not specified in" }
!$omp end parallel
end subroutine

View File

@ -29,7 +29,7 @@ subroutine foo (vara, varb, varc, vard, n)
!$omp master
vara(1) = 1 ! { dg-error "not specified" }
varb(1) = 1 ! Assumed-size is predetermined
varc(1) = 1 ! { dg-error "not specified" "" { xfail *-*-* } }
varc(1) = 1 ! { dg-error "not specified" }
vard(1) = 1 ! { dg-error "not specified" }
vare(1) = 1 ! { dg-error "not specified" }
!$omp end master