ELEMENTAL conflicts with BIND(C). However, the following is not rejected (diagnosed) by gfortran: elemental subroutine sub(x) integer, intent(in) :: x entry sub_c(x) bind(c) end subroutine sub Actually, this is a loop hole in the Fortran 2003 standard, which will be presumably fixed by an erratum. (It passed the J3 ballot, WG3 and ISO approval are still needed.) See F03/0086: ANSWER: No, it is not allowed. Constraint C1242 was intended to disallow the combination of elemental and BIND(C), but it inadvertently failed to cover the case shown in the above example. EDITS Replace C1242 in subclause 12.5.2.1 with [280:6-7] "C1242 An ELEMENTAL procedure shall not have the BIND attribute.".
Draft 2003 corrigendum 3: ftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1727.pdf (Not yet sent to ISO and thus also not ISO approved.)
(In reply to comment #1) > Draft 2003 corrigendum 3: ftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1727.pdf > (Not yet sent to ISO and thus also not ISO approved.) See ftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1731.pdf
That code is now rejected (for a wrong reason), due to PR61765.
This is C1252 An elemental procedure shall not have the BIND attribute. in subclause 12.6.2.1 of my Fortran 2015 draft.
Author: kargl Date: Fri Jan 11 23:41:04 2019 New Revision: 267864 URL: https://gcc.gnu.org/viewcvs?rev=267864&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/gfortran.dg/pr35031.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/testsuite/ChangeLog
Author: kargl Date: Sat Jan 12 00:14:55 2019 New Revision: 267869 URL: https://gcc.gnu.org/viewcvs?rev=267869&root=gcc&view=rev Log: 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. Added: branches/gcc-8-branch/gcc/testsuite/gfortran.dg/pr35031.f90 Modified: branches/gcc-8-branch/gcc/fortran/ChangeLog branches/gcc-8-branch/gcc/fortran/decl.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
Author: kargl Date: Sat Jan 12 00:33:01 2019 New Revision: 267874 URL: https://gcc.gnu.org/viewcvs?rev=267874&root=gcc&view=rev Log: 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. Added: branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr35031.f90 Modified: branches/gcc-7-branch/gcc/fortran/ChangeLog branches/gcc-7-branch/gcc/fortran/decl.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
Fixed on trunk, branch8, and branch-7. Closing.