* [patch, fortran] Fix PR 60355, missing error for BIND(C) outside module scope
@ 2017-08-02 13:19 Thomas Koenig
2017-08-09 19:55 ` *ping* " Thomas Koenig
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Koenig @ 2017-08-02 13:19 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
Hello world,
the attached patch is a bit smaller than it looks, because most of
it is due to reformatting a large comment. It is rather simple -
checking for an incorrectly placed BIND(C) variable was sometimes not
done because the test was mixed in with other tests where implicitly
typed variables were excluded.
Regression-tested. OK for trunk?
Regards
Thomas
2017-08-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/60355
* resolve.c (resolve_symbol): Adjust (and reformat)
comment. Perform check if a BIND(C) is declared
at module level regardless of whether it is typed
implicitly or not.
2017-08-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/60355
* gfortran.dg (bind_c_usage_30): New test.
[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 2398 bytes --]
Index: resolve.c
===================================================================
--- resolve.c (Revision 250720)
+++ resolve.c (Arbeitskopie)
@@ -14397,17 +14397,18 @@ resolve_symbol (gfc_symbol *sym)
}
}
- /* If the symbol is marked as bind(c), verify it's type and kind. Do not
- do this for something that was implicitly typed because that is handled
- in gfc_set_default_type. Handle dummy arguments and procedure
- definitions separately. Also, anything that is use associated is not
- handled here but instead is handled in the module it is declared in.
- Finally, derived type definitions are allowed to be BIND(C) since that
- only implies that they're interoperable, and they are checked fully for
- interoperability when a variable is declared of that type. */
- if (sym->attr.is_bind_c && sym->attr.implicit_type == 0 &&
- sym->attr.use_assoc == 0 && sym->attr.dummy == 0 &&
- sym->attr.flavor != FL_PROCEDURE && sym->attr.flavor != FL_DERIVED)
+ /* If the symbol is marked as bind(c), that it is declared at module level
+ scope and verify its type and kind. Do not do the latter for symbols
+ that are implicitly typed because that is handled in
+ gfc_set_default_type. Handle dummy arguments and procedure definitions
+ separately. Also, anything that is use associated is not handled here
+ but instead is handled in the module it is declared in. Finally, derived
+ type definitions are allowed to be BIND(C) since that only implies that
+ they're interoperable, and they are checked fully for interoperability
+ when a variable is declared of that type. */
+ if (sym->attr.is_bind_c && sym->attr.use_assoc == 0
+ && sym->attr.dummy == 0 && sym->attr.flavor != FL_PROCEDURE
+ && sym->attr.flavor != FL_DERIVED)
{
bool t = true;
@@ -14421,11 +14422,11 @@ resolve_symbol (gfc_symbol *sym)
"module level scope", sym->name, &(sym->declared_at));
t = false;
}
- else if (sym->common_head != NULL)
+ else if (sym->common_head != NULL && sym->attr.implicit_type == 0)
{
t = verify_com_block_vars_c_interop (sym->common_head);
}
- else
+ else if (sym->attr.implicit_type == 0)
{
/* If type() declaration, we need to verify that the components
of the given type are all C interoperable, etc. */
[-- Attachment #3: bind_c_usage_30.f90 --]
[-- Type: text/x-fortran, Size: 201 bytes --]
! { dg-do compile }
! PR 60355 - there was no error message for implicitly typed variables
! Test case contributed by Vladimir Fuka
program main
bind(c) test_BIND ! { dg-error "cannot be BIND" }
END
^ permalink raw reply [flat|nested] 4+ messages in thread
* *ping* [patch, fortran] Fix PR 60355, missing error for BIND(C) outside module scope
2017-08-02 13:19 [patch, fortran] Fix PR 60355, missing error for BIND(C) outside module scope Thomas Koenig
@ 2017-08-09 19:55 ` Thomas Koenig
2017-08-10 11:25 ` Paul Richard Thomas
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Koenig @ 2017-08-09 19:55 UTC (permalink / raw)
To: fortran, gcc-patches
Am 02.08.2017 um 15:19 schrieb Thomas Koenig:
> the attached patch is a bit smaller than it looks, because most of
> it is due to reformatting a large comment. It is rather simple -
> checking for an incorrectly placed BIND(C) variable was sometimes not
> done because the test was mixed in with other tests where implicitly
> typed variables were excluded.
>
> Regression-tested. OK for trunk?
Ping.
Patch at:
https://gcc.gnu.org/ml/fortran/2017-08/msg00010.html
Regards
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: *ping* [patch, fortran] Fix PR 60355, missing error for BIND(C) outside module scope
2017-08-09 19:55 ` *ping* " Thomas Koenig
@ 2017-08-10 11:25 ` Paul Richard Thomas
2017-08-11 18:05 ` Thomas Koenig
0 siblings, 1 reply; 4+ messages in thread
From: Paul Richard Thomas @ 2017-08-10 11:25 UTC (permalink / raw)
To: Thomas Koenig; +Cc: fortran, gcc-patches
Hi Thomas,
It looks fine to me. OK for trunk.
Thanks
Paul
PS What about PR34640 ?????
On 9 August 2017 at 20:44, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Am 02.08.2017 um 15:19 schrieb Thomas Koenig:
>>
>> the attached patch is a bit smaller than it looks, because most of
>> it is due to reformatting a large comment. It is rather simple -
>> checking for an incorrectly placed BIND(C) variable was sometimes not
>> done because the test was mixed in with other tests where implicitly
>> typed variables were excluded.
>>
>> Regression-tested. OK for trunk?
>
>
> Ping.
>
> Patch at:
>
> https://gcc.gnu.org/ml/fortran/2017-08/msg00010.html
>
> Regards
>
> Thomas
--
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: *ping* [patch, fortran] Fix PR 60355, missing error for BIND(C) outside module scope
2017-08-10 11:25 ` Paul Richard Thomas
@ 2017-08-11 18:05 ` Thomas Koenig
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Koenig @ 2017-08-11 18:05 UTC (permalink / raw)
To: Paul Richard Thomas; +Cc: fortran, gcc-patches
Hi Paul,
> It looks fine to me. OK for trunk.
>
Thanks, committed.
> Paul
>
> PS What about PR34640 ?????
Your patch is OK if you bump the library version.
Regards
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-11 17:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-02 13:19 [patch, fortran] Fix PR 60355, missing error for BIND(C) outside module scope Thomas Koenig
2017-08-09 19:55 ` *ping* " Thomas Koenig
2017-08-10 11:25 ` Paul Richard Thomas
2017-08-11 18:05 ` Thomas Koenig
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).