[Bug fortran/30865] optional argument passed on to size(...,dim=)

pault at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Feb 20 05:34:00 GMT 2007



------- Comment #1 from pault at gcc dot gnu dot org  2007-02-20 05:34 -------
Confirmed:

The first call to checkv produces
    checkv (&ires, &parm.10, 0B);

With prototype: checkv (ires, a1, opt1), the call to size1 is
*ires = _gfortran_size1 (&parm.6, *opt1);

with the obvious consequences.

Paul

As an aside, Thomas, it seems to me that the fix is relatively easy:
trans-intrinsic.c:2702

  actual = actual->next;
  if (actual->expr)
    {
      gfc_init_se (&argse, NULL);
      gfc_conv_expr_type (&argse, actual->expr, gfc_array_index_type);
      gfc_add_block_to_block (&se->pre, &argse.pre);
      args = gfc_chainon_list (args, argse.expr);
      fndecl = gfor_fndecl_size1;
    }
  else
    fndecl = gfor_fndecl_size0;

We need a tree conditional that effects this:
fndecl = argse.pre == 0B ? gfor_fndecl_size0 : gfor_fndecl_size1


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30865



More information about the Gcc-bugs mailing list