* [Patch, fortran] PR39239 EQUIVALENCE and BIND(C)
@ 2017-03-19 0:15 Nicolas Koenig
2017-03-19 12:02 ` Paul Richard Thomas
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Koenig @ 2017-03-19 0:15 UTC (permalink / raw)
To: fortran; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 546 bytes --]
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.
[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 595 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 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
[-- Attachment #3: equiv_constraint_bind_c.f90 --]
[-- Type: text/x-fortran, Size: 245 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 BIND" }
end module m
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, fortran] PR39239 EQUIVALENCE and BIND(C)
2017-03-19 0:15 [Patch, fortran] PR39239 EQUIVALENCE and BIND(C) Nicolas Koenig
@ 2017-03-19 12:02 ` Paul Richard Thomas
[not found] ` <06176ef6-0a55-bb29-3ee9-f76698843389@student.ethz.ch>
0 siblings, 1 reply; 3+ messages in thread
From: Paul Richard Thomas @ 2017-03-19 12:02 UTC (permalink / raw)
To: Nicolas Koenig; +Cc: fortran, gcc-patches
Hi Nicolas,
Is there some reason that you didn't use symbol.c(check_conflict)? The
conflict check could be added at line 547. If this results in
repetitions of the error message, then your patch is OK. Otherwise, I
would pop it in there.
Do you have commit rights? ie. have you done the FSF paperwork?
Welcome aboard!
Paul
On 19 March 2017 at 00:15, Nicolas Koenig <koenigni@student.ethz.ch> wrote:
> 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.
>
--
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, fortran] PR39239 EQUIVALENCE and BIND(C)
[not found] ` <06176ef6-0a55-bb29-3ee9-f76698843389@student.ethz.ch>
@ 2017-03-20 9:35 ` Paul Richard Thomas
0 siblings, 0 replies; 3+ messages in thread
From: Paul Richard Thomas @ 2017-03-20 9:35 UTC (permalink / raw)
To: Nicolas Koenig; +Cc: fortran, gcc-patches
Dear Nicolas,
This is OK for trunk.
Thanks for the patch.
Paul
On 19 March 2017 at 14:34, Nicolas Koenig <koenigni@student.ethz.ch> wrote:
> Hello Paul,
>
> there isn't really a reason for that except for not knowing where to put the
> error. Attached are the new patch & test case.
>
> The paperwork is done and I have commit rights.
>
> Thanks for the kind welcome!
>
> Nicolas
>
> Regression tested for x86_64-pc-linux-gnu.
>
> 2017-03-12 Nicolas Koenig <koenigni@student.ethz.ch>
>
> PR fortran/39239
> * symbol.c (check_conflict): 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.
>
>
> On 03/19/2017 01:02 PM, Paul Richard Thomas wrote:
>>
>> Hi Nicolas,
>>
>> Is there some reason that you didn't use symbol.c(check_conflict)? The
>> conflict check could be added at line 547. If this results in
>> repetitions of the error message, then your patch is OK. Otherwise, I
>> would pop it in there.
>>
>> Do you have commit rights? ie. have you done the FSF paperwork?
>>
>> Welcome aboard!
>>
>> Paul
>>
>> On 19 March 2017 at 00:15, Nicolas Koenig <koenigni@student.ethz.ch>
>> wrote:
>>>
>>> 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.
>>>
>>
>>
>
--
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-20 9:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-19 0:15 [Patch, fortran] PR39239 EQUIVALENCE and BIND(C) Nicolas Koenig
2017-03-19 12:02 ` Paul Richard Thomas
[not found] ` <06176ef6-0a55-bb29-3ee9-f76698843389@student.ethz.ch>
2017-03-20 9:35 ` Paul Richard Thomas
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).