diff mbox

[fortran] PR39239 reject BIND(C) in EQUIVALENCE

Message ID 8d278c32-84a2-aabd-88a8-b7c8a95adaf8@student.ethz.ch
State New
Headers show

Commit Message

Nicolas Koenig March 12, 2017, 7:29 p.m. UTC
Hello everyone,

this is my first attempt at a patch. The necessary paperwork for me to 
contribute is all said & done. I'm looking forward to some more compiler 
hacking :)

Nicolas

Here is the changelog:

2017-03-12  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-12  Nicolas Koenig  <koenigni@student.ethz.ch>

                 PR fortran/39239
                 * gfortran.dg/equiv_constraint_bind_c.f90: New test.

Comments

Jerry DeLisle March 12, 2017, 8:08 p.m. UTC | #1
On 03/12/2017 12:29 PM, Nicolas Koenig wrote:
> Hello everyone,
>
> this is my first attempt at a patch. The necessary paperwork for me to
> contribute is all said & done. I'm looking forward to some more compiler hacking :)
>
> Nicolas
>
> Here is the changelog:
>
> 2017-03-12  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-12  Nicolas Koenig  <koenigni@student.ethz.ch>
>
>                 PR fortran/39239
>                 * gfortran.dg/equiv_constraint_bind_c.f90: New test.
>

Thanks for joining the effort. I can not say enough about how badly we need help.

Best regards!

Jerry
diff mbox

Patch

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 C interop",
+                     sym->name, &e->where);
+	  continue;
+	}
+
       /* Check that the types correspond correctly:
 	 Note 5.28:
 	 A numeric sequence structure may be equivalenced to another sequence