------- Comment #3 from sgk at troutmask dot apl dot washington dot edu
2008-05-16 22:10 -------
Subject: Re: PUBLIC and PRIVATE abuse
On Fri, May 16, 2008 at 09:58:47PM -0000, burnus at gcc dot gnu dot org wrote:
>
> And using
>
> bind(C) :: a
Nice catch.
> gives even an ICE. For PUBLIC and PRIVATE, see the patch below. "save"
> and "value" are not needed they give already the error "Cannot change
> attributes of USE-associated symbol a". (My hope was that one gets a
> better error message, but one does not.)
Your patch is similar to my initial patch, and I also found the
error message to be less than informative. Here, my alternative.
Index: symbol.c
===================================================================
--- symbol.c (revision 135407)
+++ symbol.c (working copy)
@@ -361,6 +361,13 @@
if (where == NULL)
where = &gfc_current_locus;
+ if (attr->flavor == FL_MODULE
+ && (attr->access == ACCESS_PUBLIC || attr->access == ACCESS_PRIVATE))
+ {
+ a1 = attr->access == ACCESS_PUBLIC ? public : private;
+ gfc_warning ("%s attribute applied to MODULE %s at %L", a1, name,
where);
+ }
+
I chose a warning instead of an error because this issue doesn't
seem to effect anything.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36251