Early ping ;-)  – but actually I do want to explain some parts of my
patch, what I forgot in my first patch email.

Note that while "class(t)" is of declared type when
unallocated/unassociated, "class(*)" is not. Thus, when
unassociated/unallocated, "same_type_as(class_star, class_star)" is
.false. Code wise, this implies the extra check for class_star._vtab ==
NULL while class_t._vtab is always set and, thus, class._vtab->hash is
always available. (Unchanged in this patch, but probably not obvious
without reading the standard.)

On 28.09.21 18:25, Tobias Burnus wrote:
-  if (UNLIMITED_POLY (a))
+  bool unlimited_poly_a = UNLIMITED_POLY (a);
+  bool unlimited_poly_b = UNLIMITED_POLY (b);
Those variables are needed as we add component refs later, which then
cause UNLIMITED_POLY to evaluate false. UNLIMITED_POLY operates on on
expr->ts – thus, it already caters for derived-type accesses.
+  if (unlimited_poly_a)
      {
-      tmp = gfc_class_vptr_get (a->symtree->n.sym->backend_decl);
This caused the ICE as backend_decl was NULL. Additionally, it assumes
that the sym and not some component of it is the requested
unlimited-polymorphic object. Without the latter issue, a simple
gfc_get_symbol_decl() around the argument would be sufficient.
+      se1.want_pointer = 1;
+      gfc_add_vptr_component (a);

The gfc_add_vptr_component handles expr->ref->type == REF_COMPONENT
properly. As also used for the "else if" branch, DT are handled properly.

I think the rest of the patch is obvious.

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to