diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-05-27 17:31:26 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-05-27 17:31:26 +0000 |
commit | b6e841a699fe43ddf632dd79e0002dd51c8bf864 (patch) | |
tree | 2bbd87f3ef4495f4647af69248548e2a0674e449 /gcc/fortran/decl.c | |
parent | f5435230c9eabde57c2c87d046ed98792e896c6f (diff) | |
download | gcc-b6e841a699fe43ddf632dd79e0002dd51c8bf864.zip gcc-b6e841a699fe43ddf632dd79e0002dd51c8bf864.tar.gz gcc-b6e841a699fe43ddf632dd79e0002dd51c8bf864.tar.bz2 |
decl.c (match_data_constant): Fortran 2018 allows pointer initialization in a data statement.
2018-05-27 Steven G. Kargl <kargl@gcc.gnu.org>
* decl.c (match_data_constant): Fortran 2018 allows pointer
initialization in a data statement.
2018-05-27 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/data_stmt_pointer.f90: new test.
From-SVN: r260808
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index bd343b2..2fca8ad 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -387,7 +387,20 @@ match_data_constant (gfc_expr **result) return m; } else if (m == MATCH_YES) - gfc_free_expr (*result); + { + /* F2018:R845 data-stmt-constant is initial-data-target. + A data-stmt-constant shall be ... initial-data-target if and + only if the corresponding data-stmt-object has the POINTER + attribute. ... If data-stmt-constant is initial-data-target + the corresponding data statement object shall be + data-pointer-initialization compatible (7.5.4.6) with the initial + data target; the data statement object is initially associated + with the target. */ + if ((*result)->symtree->n.sym->attr.save + && (*result)->symtree->n.sym->attr.target) + return m; + gfc_free_expr (*result); + } gfc_current_locus = old_loc; |