This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/37926] Program gives wrong output (connected to char len)



------- Comment #2 from pault at gcc dot gnu dot org  2008-10-28 18:42 -------
(In reply to comment #1)
Tobias,

Isn't the problem the following?

    parm.22.dim[0].lbound = 1;
    parm.22.dim[0].ubound = D.1616;
    parm.22.dim[0].stride = NON_LVALUE_EXPR <D.1622>;
    parm.22.data = (void *) &(*ifm.21)[0];
    parm.22.offset = NON_LVALUE_EXPR <D.1621>;
    D.1623 = _gfortran_internal_pack (&parm.22);  /**** void* result ****/
    D.1625 = mysize (D.1623); /**** mysize expects struct
array1_integer(kind=4) & a   ****/
    D.1627 = MAX_EXPR <D.1625, 0> * 64;
    if (D.1627 < 0)
      {
        _gfortran_runtime_error (&"Attempt to allocate a negative amount of
memory."[1]{lb: 1 sz: 1});
      }
    D.1628 = __builtin_malloc (MAX_EXPR <(integer(kind=8)) D.1627, 1>);
    if (D.1628 == 0B)
      {
        _gfortran_os_error (&"Memory allocation failed"[1]{lb: 1 sz: 1});
      }
    pstr.23 = (character(kind=1)[1:MAX_EXPR <D.1625, 0>] *) D.1628;
    p (pstr.23, MAX_EXPR <D.1625, 0>, D.1614, mysize);


Thus it's the internal_pack that does this in.

Paul


-- 


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


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