summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-05 12:51:51 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-05 12:51:51 +0000
commitbc5d64382b37983254f3739589a1d1f3cdc37ecd (patch)
tree1281d63a921c00f8d91cb684061e182b7c459e18
parented69c8530bf8ae2d86c97877f96b133d58a3fd7b (diff)
downloadgcc-bc5d64382b37983254f3739589a1d1f3cdc37ecd.tar.gz
gcc/fortran/
2007-07-05 Daniel Franke <franke.daniel@gmail.com> Tobias Burnus <burnus@net-b.de> PR fortran/32359 * gfortran.h (symbol_attribute): Change save attribute into an enum. * decl.c (add_init_expr_to_sym): Set it to SAVE_IMPLICIT. * symbol.c (gfc_add_save): Check for SAVE_EXPLICIT. * resolve.c (resolve_fl_variable): Check for SAVE_EXPLICIT. (resolve_symbol): Allow OMP threadprivate with initialization SAVEd and save_all variable. * trans-decl.c (gfc_finish_var_decl): Remove obsolete sym->value check. libgomp/ 2007-07-05 Tobias Burnus <burnus@net-b.de> PR fortran/32359 * testsuite/libgomp.fortran/pr32359.f90: New. gcc/testsuite/ 2007-07-05 Tobias Burnus <burnus@net-b.de> PR fortran/32359 * gfortran.dg/module_md5_1.f90: Update MD5 number. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126366 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog12
-rw-r--r--gcc/fortran/decl.c1
-rw-r--r--gcc/fortran/gfortran.h10
-rw-r--r--gcc/fortran/resolve.c7
-rw-r--r--gcc/fortran/symbol.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/module_md5_1.f902
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.fortran/pr32359.f9034
9 files changed, 73 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7504c715eee..0173eb3d7ca 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,15 @@
+2007-07-05 Daniel Franke <franke.daniel@gmail.com>
+ Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32359
+ * gfortran.h (symbol_attribute): Change save attribute into an enum.
+ * decl.c (add_init_expr_to_sym): Set it to SAVE_IMPLICIT.
+ * symbol.c (gfc_add_save): Check for SAVE_EXPLICIT.
+ * resolve.c (resolve_fl_variable): Check for SAVE_EXPLICIT.
+ (resolve_symbol): Allow OMP threadprivate with
+ initialization SAVEd and save_all variable.
+ * trans-decl.c (gfc_finish_var_decl): Remove obsolete sym->value check.
+
2007-07-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/32526
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index b3bbe75d162..2c828bab08b 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1232,6 +1232,7 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
}
sym->value = init;
+ sym->attr.save = SAVE_IMPLICIT;
*initp = NULL;
}
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 6a0fd091ec5..3c15c61a02e 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -297,6 +297,12 @@ typedef enum ifsrc
}
ifsrc;
+/* Whether a SAVE attribute was set explicitly or implictly. */
+typedef enum save_state
+{ SAVE_NONE = 0, SAVE_EXPLICIT, SAVE_IMPLICIT
+}
+save_state;
+
/* Strings for all symbol attributes. We use these for dumping the
parse tree, in error messages, and also when reading and writing
modules. In symbol.c. */
@@ -620,10 +626,12 @@ typedef struct
{
/* Variable attributes. */
unsigned allocatable:1, dimension:1, external:1, intrinsic:1,
- optional:1, pointer:1, save:1, target:1, value:1, volatile_:1,
+ optional:1, pointer:1, target:1, value:1, volatile_:1,
dummy:1, result:1, assign:1, threadprivate:1, not_always_present:1,
implied_index:1;
+ ENUM_BITFIELD (save_state) save:2;
+
unsigned data:1, /* Symbol is named in a DATA statement. */
protected:1, /* Symbol has been marked as protected. */
use_assoc:1, /* Symbol has been use-associated. */
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 158abe02327..299d4307a62 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -6508,8 +6508,9 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag)
}
}
- /* Also, they must not have the SAVE attribute. */
- if (flag && sym->attr.save)
+ /* Also, they must not have the SAVE attribute.
+ SAVE_IMPLICIT is checked below. */
+ if (flag && sym->attr.save == SAVE_EXPLICIT)
{
gfc_error (auto_save_msg, sym->name, &sym->declared_at);
return FAILURE;
@@ -7287,7 +7288,7 @@ resolve_symbol (gfc_symbol *sym)
gfc_resolve (sym->formal_ns);
/* Check threadprivate restrictions. */
- if (sym->attr.threadprivate && !sym->attr.save
+ if (sym->attr.threadprivate && !sym->attr.save && !sym->ns->save_all
&& (!sym->attr.in_common
&& sym->module == NULL
&& (sym->ns->proc_name == NULL
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index c7527bfb1c1..42f7776dff6 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -925,7 +925,7 @@ gfc_add_save (symbol_attribute *attr, const char *name, locus *where)
return FAILURE;
}
- if (attr->save)
+ if (attr->save == SAVE_EXPLICIT)
{
if (gfc_notify_std (GFC_STD_LEGACY,
"Duplicate SAVE attribute specified at %L",
@@ -934,7 +934,7 @@ gfc_add_save (symbol_attribute *attr, const char *name, locus *where)
return FAILURE;
}
- attr->save = 1;
+ attr->save = SAVE_EXPLICIT;
return check_conflict (attr, name, where);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 034f9cd2ac3..e7888e1d2c1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-05 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32359
+ * gfortran.dg/module_md5_1.f90: Update MD5 number.
+
2007-07-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/32526
diff --git a/gcc/testsuite/gfortran.dg/module_md5_1.f90 b/gcc/testsuite/gfortran.dg/module_md5_1.f90
index 45792bda389..6382df1eb32 100644
--- a/gcc/testsuite/gfortran.dg/module_md5_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_md5_1.f90
@@ -10,5 +10,5 @@ program test
use foo
print *, pi
end program test
-! { dg-final { scan-module "foo" "MD5:10e58dd12566bfc60412da6f8f8f7a07" } }
+! { dg-final { scan-module "foo" "MD5:6d026a84bb779a7b6789854d85d4f01f" } }
! { dg-final { cleanup-modules "foo" } }
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index a9d1f5a40be..c8c1247ada5 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-05 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32359
+ * testsuite/libgomp.fortran/pr32359.f90: New.
+
2007-07-02 Jakub Jelinek <jakub@redhat.com>
PR libgomp/32468
diff --git a/libgomp/testsuite/libgomp.fortran/pr32359.f90 b/libgomp/testsuite/libgomp.fortran/pr32359.f90
new file mode 100644
index 00000000000..e48a8a70406
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/pr32359.f90
@@ -0,0 +1,34 @@
+! { dg-do compile }
+!
+! PR fortran/32359
+! Contributed by Bill Long <longb@cray.com>
+
+subroutine test
+ use omp_lib
+ implicit none
+ integer, parameter :: NT = 4
+ integer :: a
+ save
+!$omp threadprivate(a)
+ a = 1
+
+!$ call omp_set_num_threads(NT)
+!$omp parallel
+ print *, omp_get_thread_num(), a
+!$omp end parallel
+
+end subroutine test
+
+! Derived from OpenMP test omp1/F2_6_2_8_5i.f90
+ use omp_lib
+ implicit none
+ integer, parameter :: NT = 4
+ integer :: a = 1
+!$omp threadprivate(a)
+
+!$ call omp_set_num_threads(NT)
+!$omp parallel
+ print *, omp_get_thread_num(), a
+!$omp end parallel
+
+ END