aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.c
diff options
context:
space:
mode:
authorDaniel Franke <franke.daniel@gmail.com>2007-07-06 08:37:22 -0400
committerDaniel Franke <dfranke@gcc.gnu.org>2007-07-06 08:37:22 -0400
commitef7236d25b52738a4de814b587cab39bf8babb08 (patch)
treee23e329b9cee8d78d66c5fb40698f15edf6dcf2b /gcc/fortran/symbol.c
parent004e2fa73b7677e460c760878469d7a6c3759ea4 (diff)
downloadgcc-ef7236d25b52738a4de814b587cab39bf8babb08.zip
gcc-ef7236d25b52738a4de814b587cab39bf8babb08.tar.gz
gcc-ef7236d25b52738a4de814b587cab39bf8babb08.tar.bz2
re PR fortran/32633 (bogus error)
gcc/fortran: 2007-05-06 Daniel Franke <franke.daniel@gmail.com> PR fortran/32633 * symbol.c (save_status): New. * gfortran.h (save_status): Added external declaration. (check_conflict): Check for conflicting explicite SAVE statements only. (gen_special_c_interop_ptr): Use SAVE_EXPLICIT constant. * module.c (ab_attribute, attr_bits): Removed enumerator value AB_SAVE for save attribute. (mio_symbol_attribute): Import/export the full SAVE status, removed usage of AB_SAVE. * dump-parse-tree.c (gfc_show_attr): Dump full SAVE status. * decl.c (add_init_expr_to_sym): Set SAVE_IMPLICIT only if not already explicit. gcc/testsuite: 2007-07-06 Daniel Franke <franke.daniel@gmail.com> * gfortran.dg/save_parameter.f90: New test. * gfortran.dg/module_md5_1.f90: Updated MD5 sum. From-SVN: r126413
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r--gcc/fortran/symbol.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 42f7776..5e76fe2 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -79,6 +79,12 @@ const mstring ifsrc_types[] =
minit ("USAGE", IFSRC_USAGE)
};
+const mstring save_status[] =
+{
+ minit ("UNKNOWN", SAVE_NONE),
+ minit ("EXPLICIT-SAVE", SAVE_EXPLICIT),
+ minit ("IMPLICIT-SAVE", SAVE_IMPLICIT),
+};
/* This is to make sure the backend generates setup code in the correct
order. */
@@ -393,9 +399,34 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
}
}
+ if (attr->save == SAVE_EXPLICIT)
+ {
+ conf (dummy, save);
+ conf (in_common, save);
+ conf (result, save);
+
+ switch (attr->flavor)
+ {
+ case FL_PROGRAM:
+ case FL_BLOCK_DATA:
+ case FL_MODULE:
+ case FL_LABEL:
+ case FL_PROCEDURE:
+ case FL_DERIVED:
+ case FL_PARAMETER:
+ a1 = gfc_code2string (flavors, attr->flavor);
+ a2 = save;
+ goto conflict;
+
+ case FL_VARIABLE:
+ case FL_NAMELIST:
+ default:
+ break;
+ }
+ }
+
conf (dummy, entry);
conf (dummy, intrinsic);
- conf (dummy, save);
conf (dummy, threadprivate);
conf (pointer, target);
conf (pointer, intrinsic);
@@ -407,7 +438,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (external, dimension); /* See Fortran 95's R504. */
conf (external, intrinsic);
-
+
if (attr->if_source || attr->contained)
{
conf (external, subroutine);
@@ -423,8 +454,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (in_common, dummy);
conf (in_common, allocatable);
conf (in_common, result);
- conf (in_common, save);
- conf (result, save);
conf (dummy, result);
@@ -536,7 +565,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
case FL_LABEL:
conf2 (dimension);
conf2 (dummy);
- conf2 (save);
conf2 (volatile_);
conf2 (pointer);
conf2 (protected);
@@ -558,7 +586,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
case FL_PROCEDURE:
conf2 (intent);
- conf2 (save);
if (attr->subroutine)
{
@@ -586,7 +613,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
case PROC_DUMMY:
conf2 (result);
conf2 (in_common);
- conf2 (save);
conf2 (threadprivate);
break;
@@ -598,7 +624,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
case FL_DERIVED:
conf2 (dummy);
- conf2 (save);
conf2 (pointer);
conf2 (target);
conf2 (external);
@@ -630,7 +655,6 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf2 (target);
conf2 (dummy);
conf2 (in_common);
- conf2 (save);
conf2 (value);
conf2 (volatile_);
conf2 (threadprivate);
@@ -3161,7 +3185,7 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
/* Set up the symbol's important fields. Save attr required so we can
initialize the ptr to NULL. */
- tmp_sym->attr.save = 1;
+ tmp_sym->attr.save = SAVE_EXPLICIT;
tmp_sym->ts.is_c_interop = 1;
tmp_sym->attr.is_c_interop = 1;
tmp_sym->ts.is_iso_c = 1;