This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch,Fortran] PR 40873 - -fwhole-program decl fixes


Le 27.07.2010 07:54, Tobias Burnus a écrit :

Mikael Morin wrote:
Le 26.07.2010 22:32, Tobias Burnus a écrit :
Build and and currently regtesting on x86-64-linux. If there is no
failure:
OK for the trunk?
The extra expr.c hunk (pr45081 fix) which slipped through, is ok (and
obvious).
But regresses in terms of diagnostics - I will leave it out and have a
separate look later.

For the interface thing see below.        /* F2003, 12.3.1.1 (3b);
F2008, 12.4.2.2 (3b) */
-      if (def_sym->result->attr.pointer
-          || def_sym->result->attr.allocatable)
+      if ((def_sym->result->attr.pointer
+           || def_sym->result->attr.allocatable)
+&&  (sym->attr.if_source != IFSRC_IFBODY
The above makes sense, but the 4 following lines are odd.

If I understand it correctly if there is a function
definition/interface mismatch (between pointer or allocatable
attributes), we generate an error asking for explicit interface (even
if the symbol comes from an interface block which _is_ an explicit
interface).
Well, maybe it's better than nothing after all.

That was my idea - I think interface mismatches are rare enough that one does not need to replicate all the messages - and the error might be slightly odd, but should give a good hint.
OK, we can wait for someone to open a PR(if any) to decide to do something here.


+           || def_sym->result->attr.pointer
+            != sym->result->attr.pointer)
There is an extra parenthesis here
I concur.

+ || (def_sym->result->attr.allocatable
And another one here

I concur. With those changes - which I spotted after I had send the email (but did not want to send a reply before testing finished), regtesting succeeded.


            &&  def_sym->ts.u.cl->length != NULL)
          {
            gfc_charlen *cl = sym->ts.u.cl;
@@ -1992,14 +1998,14 @@ resolve_global_procedure (gfc_symbol *sy
      }

        /* F2003, 12.3.1.1 (4); F2008, 12.4.2.2 (4) */
-      if (def_sym->attr.elemental)
+      if (def_sym->attr.elemental&&  !sym->attr.elemental)
Same as above, I would put
if (def_sym->attr.elemental&&  sym->attr.if_source != IFSRC_IFBODY)
like in the previous cases.
It is odd to guess interface explicitness out of symbol elementalness.

Well, I want to print also an error if the INTERFACE has no ELEMENTAL - I could split the message in one for IFSRC_IFBODY and one for wrong interfaces, if you think it makes sense.
I was afraid that one could come up with a case where both def_sym and sym were declared as elemental (without interface body), thus skipping the check. I can't produce one, however, so it's probably fine as is.

-      if (def_sym->attr.is_bind_c)
+      if (def_sym->attr.is_bind_c&&  !sym->attr.is_bind_c)
Same here.

Ditto.
Same here. No failing testcase.

Thanks for the review!


Tobias

Thanks for all your whole-file work.
Mikael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]