diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-01-11 23:41:04 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-01-11 23:41:04 +0000 |
commit | 89508a3fc645ef37340e31c74995c3078e1b1b9b (patch) | |
tree | 0e1a3fc3e9ba1e6c9ce192f289548c709d34c571 /gcc | |
parent | e334d7a702b21feafc8420495f7e91f22336e101 (diff) | |
download | gcc-89508a3fc645ef37340e31c74995c3078e1b1b9b.zip gcc-89508a3fc645ef37340e31c74995c3078e1b1b9b.tar.gz gcc-89508a3fc645ef37340e31c74995c3078e1b1b9b.tar.bz2 |
re PR fortran/35031 (ELEMENTAL procedure with BIND(C))
2019-01-11 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/35031
* decl.c (gfc_match_entry): Check for F2018:C1546. Fix nearby
mis-indentation.
2019-01-11 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/35031
* gfortran.dg/pr35031.f90: new test.
From-SVN: r267864
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr35031.f90 | 10 |
4 files changed, 34 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c54da9d..b05c594 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-01-11 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/35031 + * decl.c (gfc_match_entry): Check for F2018:C1546. Fix nearby + mis-indentation. + 2019-01-11 Jakub Jelinek <jakub@redhat.com> PR middle-end/85956 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index e5bfc3b..3314e17 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -7431,9 +7431,11 @@ gfc_match_entry (void) gfc_error ("Missing required parentheses before BIND(C) at %C"); return MATCH_ERROR; } - if (!gfc_add_is_bind_c (&(entry->attr), entry->name, - &(entry->declared_at), 1)) - return MATCH_ERROR; + + if (!gfc_add_is_bind_c (&(entry->attr), entry->name, + &(entry->declared_at), 1)) + return MATCH_ERROR; + } if (!gfc_current_ns->parent @@ -7517,6 +7519,14 @@ gfc_match_entry (void) return MATCH_ERROR; } + /* F2018:C1546 An elemental procedure shall not have the BIND attribute. */ + if (proc->attr.elemental && entry->attr.is_bind_c) + { + gfc_error ("ENTRY statement at %L with BIND(C) prohibited in an " + "elemental procedure", &entry->declared_at); + return MATCH_ERROR; + } + entry->attr.recursive = proc->attr.recursive; entry->attr.elemental = proc->attr.elemental; entry->attr.pure = proc->attr.pure; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 11845e3..8b8ebc8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-11 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/35031 + * gfortran.dg/pr35031.f90: new test. + 2019-01-11 Marek Polacek <polacek@redhat.com> PR c++/88692, c++/87882 - -Wredundant-move false positive with *this. diff --git a/gcc/testsuite/gfortran.dg/pr35031.f90 b/gcc/testsuite/gfortran.dg/pr35031.f90 new file mode 100644 index 0000000..a4d7840 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr35031.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +elemental subroutine sub2(x) + integer, intent(in) :: x + entry sub2_c(x) bind(c) ! { dg-error "prohibited in an elemental" } +end subroutine sub2 + +elemental function func2(x) + integer, intent(in) :: x + entry func2_c(x) bind(c) ! { dg-error "prohibited in an elemental" } +end function func2 |