Commit 89508a3f by Steven G. Kargl

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
parent e334d7a7
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> 2019-01-11 Jakub Jelinek <jakub@redhat.com>
PR middle-end/85956 PR middle-end/85956
......
...@@ -7431,9 +7431,11 @@ gfc_match_entry (void) ...@@ -7431,9 +7431,11 @@ gfc_match_entry (void)
gfc_error ("Missing required parentheses before BIND(C) at %C"); gfc_error ("Missing required parentheses before BIND(C) at %C");
return MATCH_ERROR; return MATCH_ERROR;
} }
if (!gfc_add_is_bind_c (&(entry->attr), entry->name,
&(entry->declared_at), 1)) if (!gfc_add_is_bind_c (&(entry->attr), entry->name,
return MATCH_ERROR; &(entry->declared_at), 1))
return MATCH_ERROR;
} }
if (!gfc_current_ns->parent if (!gfc_current_ns->parent
...@@ -7517,6 +7519,14 @@ gfc_match_entry (void) ...@@ -7517,6 +7519,14 @@ gfc_match_entry (void)
return MATCH_ERROR; 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.recursive = proc->attr.recursive;
entry->attr.elemental = proc->attr.elemental; entry->attr.elemental = proc->attr.elemental;
entry->attr.pure = proc->attr.pure; entry->attr.pure = proc->attr.pure;
......
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> 2019-01-11 Marek Polacek <polacek@redhat.com>
PR c++/88692, c++/87882 - -Wredundant-move false positive with *this. PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment