This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, fortran] PR39239 EQUIVALENCE and BIND(C)
- From: Nicolas Koenig <koenigni at student dot ethz dot ch>
- To: <fortran at gcc dot gnu dot org>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 19 Mar 2017 01:15:46 +0100
- Subject: [Patch, fortran] PR39239 EQUIVALENCE and BIND(C)
- Authentication-results: sourceware.org; auth=none
Hello everyone,
I submitted this patch a week ago, but I think it got lost. It adds an
error if BIND(C) is used with EQUIVALENCE.
Nicolas
Regression tested for x86_64-pc-linux-gnu.
2017-03-18 Nicolas Koenig <koenigni@student.ethz.ch>
PR fortran/39239
* resolve.c (resolve_equivalence): report an error if
an equivalence variable is BIND(C).
2017-03-18 Nicolas Koenig <koenigni@student.ethz.ch>
PR fortran/39239
* gfortran.dg/equiv_constraint_bind_c.f90: New test.
Index: resolve.c
===================================================================
--- resolve.c (revision 246070)
+++ resolve.c (working copy)
@@ -15675,6 +15675,13 @@ resolve_equivalence (gfc_equiv *eq)
&& !resolve_equivalence_derived (e->ts.u.derived, sym, e))
continue;
+ if (sym->attr.is_bind_c)
+ {
+ gfc_error ("EQUIVALENCE object %qs at %L cannot be BIND(C)",
+ sym->name, &e->where);
+ continue;
+ }
+
/* Check that the types correspond correctly:
Note 5.28:
A numeric sequence structure may be equivalenced to another sequence
! Testcase for using EQUIVALENCE with BIND(C)
! See PR fortran/39239
! { dg-do compile }
module m
use iso_c_binding
implicit none
integer(c_int) :: i1, i2
bind(C) :: i2
equivalence(i1,i2) ! { dg-error "cannot be BIND" }
end module m