* [patch, fortran] PR39239 reject BIND(C) in EQUIVALENCE
@ 2017-03-12 19:29 Nicolas Koenig
2017-03-12 20:08 ` Jerry DeLisle
0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Koenig @ 2017-03-12 19:29 UTC (permalink / raw)
To: fortran; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 568 bytes --]
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.
[-- Attachment #2: p2.diff --]
[-- Type: text/x-patch, Size: 597 bytes --]
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
[-- Attachment #3: equiv_constraint_bind_c.f90 --]
[-- Type: text/x-fortran, Size: 250 bytes --]
! 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 C interop" }
end module m
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, fortran] PR39239 reject BIND(C) in EQUIVALENCE
2017-03-12 19:29 [patch, fortran] PR39239 reject BIND(C) in EQUIVALENCE Nicolas Koenig
@ 2017-03-12 20:08 ` Jerry DeLisle
0 siblings, 0 replies; 2+ messages in thread
From: Jerry DeLisle @ 2017-03-12 20:08 UTC (permalink / raw)
To: Nicolas Koenig, fortran; +Cc: gcc-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-12 20:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-12 19:29 [patch, fortran] PR39239 reject BIND(C) in EQUIVALENCE Nicolas Koenig
2017-03-12 20:08 ` Jerry DeLisle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).