[Bug fortran/104429] [9/10/11/12 Regression] ICE in gfc_conv_variable, at fortran/trans-expr.cc:3056 since r9-2664-g1312bb902382cb48

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 9 08:47:47 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104429

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem is that the following code works fine for:

   f(...)

where f returns a CLASS but it does not work for:

   x % _vptr % op[[((p:x) (p:y))]]

trans-expr.cc's gfc_conv_procedure_call

                  if (fsym && (fsym->ts.type == BT_DERIVED
                               || fsym->ts.type == BT_ASSUMED)
                      && e->ts.type == BT_CLASS
                      && !CLASS_DATA (e)->attr.dimension
                      && !CLASS_DATA (e)->attr.codimension)
                    {
...
                      if (e->expr_type == EXPR_FUNCTION
                          && CLASS_DATA (e)->attr.allocatable)
                        {
...
                          e->symtree->n.sym->attr.flavor = FL_PROCEDURE;


That works kind of fine – until:

  x % _vptr % assign ( ... )

Namely: get_proc_ptr_comp calls first gfc_conv_variable for 'x' but that ends
up at:

      else if (!sym->attr.temporary
               && sym->attr.flavor == FL_PROCEDURE
               && se->expr != current_function_decl)
        {
          if (!sym->attr.dummy && !sym->attr.proc_pointer)
            {
              gcc_assert (TREE_CODE (se->expr) == FUNCTION_DECL);

as 'x' as the FL_PROCEDURE – but it not a procedure but just a CLASS variable.


More information about the Gcc-bugs mailing list