Newsgroups: comp.parallel.pvm
From: hsong@asylum.cs.utah.edu (Hwal Song)
Subject: Help : Reading buffer
Organization: University of Utah Computer Science
Date: 20 Jan 1995 01:56:42 GMT
Message-ID: <3fn58q$n45@magus.cs.utah.edu>

I have this bug for a while and cannot find where it is from.
The error message is coming from the last line where pvm_upkfloat is.
I checked with the debugger. It copied only 29985 data[i] out of
intended 30000.

I am not sure why it stops copying.

Here is the error message and then the code.
Since realloc was successful, I find no reason of segmenatation fault.

Please look at the code and open my blind eyes.

Thank you.

signal SEGV (segmentation violation) in dec_xdr_step at 0xbc30
dec_xdr_step+0x18:      ld      [%o0 + 20], %o0
(dbx) where
dec_xdr_step() at 0xbc30
dec_xdr_float() at 0xc29c
pvm_upkfloat() at 0xec3c

    pvm_initsend( PvmDataDefault );
    pvm_pkint( msg_size, 1, 1);
    pvm_pkfloat( data, *msg_size, 1);
    dest = (me+1)%nproc;
    pvm_send( tids[dest], LOOP+10);

    pvm_recv( tids[(me+nproc-1)%nproc], LOOP+10);
    pvm_upkint( &msg_size2, 1, 1);
    data = (float *) realloc(data, sizeof(float)*msg_size2);
/*
    if (msg_size2 > *msg_size) {
        if ( NULL == (data = (float *) realloc(data, sizeof(float)*msg_size2)))
            printf("NULLLLLLLL in realloc\n");
        else
            printf("realloc done");
    }
*/
    *msg_size  = msg_size2;
    pvm_upkfloat( data, msg_size2, 1);

