------- Comment #4 from tkoenig at gcc dot gnu dot org  2008-05-05 18:57 -------
The problem isn't specific to in_pack, it's the
fact that we don't initialize the array descriptor
correctly.

s2 shows

  if (a != 0B)
    {
      {
        integer(kind=4) D.638;

        D.638 = a->dim[0].stride;
        stride.1 = D.638 != 0 ? D.638 : 1;

        ...
      }
    }
so we set stride.1 only if a is present.  So far, so good.

Later, unconditionally, we have

    struct array2_real(kind=8) parm.6;

...

    D.633 = stride.1;
    parm.6.dim[0].lbound = 1;
    parm.6.dim[0].ubound = ubound.0;
    parm.6.dim[0].stride = NON_LVALUE_EXPR <D.633>;
    parm.6.data = (void *) &(*a.0)[0];
    parm.6.offset = NON_LVALUE_EXPR <D.632>;
    D.635 = _gfortran_internal_pack (&parm.6);

We need to call _gfortran_internal_pack on optional arguments
only when the optional arguments are present.

Setting subject.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2008-05-05 18:57:28
               date|                            |
            Summary|issue with                  |_gfortran_internal_pack on
                   |_gfortran_internal_pack     |optional arguments


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

Reply via email to