This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, Fortran] PR 33412 ELEMENTAL and language bindings conflict
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Wed, 12 Sep 2007 22:34:16 +0200
- Subject: [Patch, Fortran] PR 33412 ELEMENTAL and language bindings conflict
:ADDPATCH fortran:
C1242 (R1227) A prefix shall not specify ELEMENTAL if
proc-language-binding-spec appears in the function-stmt or subroutine-stmt.
NAG f95:
Error: z.f90, line 1: BIND(C) is not allowed for elemental procedure A
Build and regression tested on x86_64-suse-linux.
OK for the trunk?
Tobias
2007-09-12 Tobias Burnus <burnus@net-b.de>
PR fortran/33412
* symbol.c (check_conflict): Add conflict of ELEMENTAL with Bind(C).
2007-09-12 Tobias Burnus <burnus@net-b.de>
PR fortran/33412
* gfortran.dg/elemental_bind_c.f90: New.
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (Revision 128444)
+++ gcc/fortran/symbol.c (Arbeitskopie)
@@ -480,6 +480,7 @@ check_conflict (symbol_attribute *attr,
conf (is_bind_c, cray_pointer);
conf (is_bind_c, cray_pointee);
conf (is_bind_c, allocatable);
+ conf (is_bind_c, elemental);
/* Need to also get volatile attr, according to 5.1 of F2003 draft.
Parameter conflict caught below. Also, value cannot be specified
Index: gcc/testsuite/gfortran.dg/elemental_bind_c.f90
===================================================================
--- gcc/testsuite/gfortran.dg/elemental_bind_c.f90 (Revision 0)
+++ gcc/testsuite/gfortran.dg/elemental_bind_c.f90 (Revision 0)
@@ -0,0 +1,10 @@
+! {dg-do compile }
+!
+! PR fortran/33412
+!
+elemental subroutine a() bind(c) ! { dg-error "BIND.C. attribute conflicts with ELEMENTAL" }
+end subroutine a ! { dg-error "Expecting END PROGRAM" }
+
+elemental function b() bind(c) ! { dg-error "BIND.C. attribute conflicts with ELEMENTAL" }
+end function b ! { dg-error "Expecting END PROGRAM" }
+end