This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Dynamic dispatch of class typebound procedures - post LTO patch for gfortran


Hi Paul!

Paul Richard Thomas wrote:
Please find attached the promised patch to implement dynamic dispatch
of class objects.  Both functions and subroutines are correctly
handled.  It should be noted that some of the error handling is a bit
ragged; eg. trying to use host associated procedures generates all the
correct error messages, followed by an ICE.  I will track these down
over the coming weeks and put them right.

Some minor comments:


+  for (; p; p = p->next)
+    empty = empty & (e->value.function.esym == p->esym);

I'd personally use '&&' here instead of '&' as reduction operator. It does not matter of course, but I see && as the "logical and" and & as bit-wise operator when I really want the bit-wise semantics.

+  if (empty)
+    goto free_elist;
+
+  return;
+
+free_elist:
+  p = e->value.function.class_esym;
+  for (; p; p = q)
+    {
+      q = p->next;
+      gfc_free (p);
+    }
+  e->value.function.class_esym = NULL;

Just a suggestion, but you could do the free'ing in the if(empty) body and get rid of the goto alltogether. I think that would be clearer and you don't need the label otherwise.

But indeed ok for trunk after it reopens.

Thanks for this patch!

Daniel

--
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri


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