diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-06-09 15:33:28 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-06-09 15:33:28 +0000 |
commit | 598dc594fa743db13fae4a884e33079a06de07e2 (patch) | |
tree | 5c2a866c63fed50de846dfdcd2665df720745fc7 /gcc/fortran/symbol.c | |
parent | 1ae28fc34c1f1baada3e40e613bce904fd283203 (diff) | |
download | gcc-598dc594fa743db13fae4a884e33079a06de07e2.zip gcc-598dc594fa743db13fae4a884e33079a06de07e2.tar.gz gcc-598dc594fa743db13fae4a884e33079a06de07e2.tar.bz2 |
re PR fortran/63514 (functions containing volatile are considered pure)
2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/63514
* symbol.c (gfc_add_volatile): Enforce F2008:C1282 and F2018:C1588.
2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/63514
* gfortran.dg/pr63514.f90: New test.
From-SVN: r261360
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r-- | gcc/fortran/symbol.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 4f06063..b4a950a 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -1349,6 +1349,20 @@ gfc_add_volatile (symbol_attribute *attr, const char *name, locus *where) where)) return false; + /* F2008: C1282 A designator of a variable with the VOLATILE attribute + shall not appear in a pure subprogram. + + F2018: C1588 A local variable of a pure subprogram, or of a BLOCK + construct within a pure subprogram, shall not have the SAVE or + VOLATILE attribute. */ + if (gfc_pure (NULL)) + { + gfc_error ("VOLATILE attribute at %L cannot be specified in a " + "PURE procedure", where); + return false; + } + + attr->volatile_ = 1; attr->volatile_ns = gfc_current_ns; return check_conflict (attr, name, where); |