Newsgroups: comp.parallel.pvm
From: ladanyi@cs.cornell.edu (La'szlo' Lada'nyi)
Subject: bug in pvm?
Organization: Cornell University Computer Science Department
Date: 30 May 1995 12:02:04 -0400
Message-ID: <3qffhs$4u5@munin.cs.cornell.edu>


I'm writing a parallel branch_and_cut code. I use purify to check that
there are no memory leaks, and other memory allocation related errors.

Well, I cannot get rid of one error, and it seems to be an error in
pvm itself (I'm using 3.3.7). I appended the output of purify to the end 
of this post. Also I appended the routine in which the `offending' line
is. (The second UMR error is the same error -- I don't know why purify 
lists it twice.)

The error must be very subtle, and it might even be a compiler (gcc 2.6.3) 
error, for the code runs without error if I compile the pvm libraries with 
debugging instead of optimizing them. Something is definitely fishy, 
because the function is called several thousand times, and only 24 times
I get the error. On smaller problems I don't get error at all either.

Can anyone give me hint what might be going on here?

Thaks in advance,
   Laci

------------------------------------ the function ---------------------

void send_finished_info(lp_prob *p, int msgtag)
{
   node_times *comp_times = &p->comp_times;
   int s_bufid=0, info=0;
   double total;

   if ((s_bufid = pvm_initsend(PvmDataRaw)) < 0) PVM_ERROR;

   if ((info = pvm_pkbyte((char *)(&p->comp_times),
			  sizeof(node_times), 1)) < 0) PVM_ERROR;
   if (p->iter_num == 0){
      if ((info = pvm_pkint(&p->iter_num, 1, 1)) < 0) PVM_ERROR;
   }else{
      if ((info = pvm_pkint(&p->level, 1, 1)) < 0) PVM_ERROR;
   }
   
   if ((info =
	pvm_send(
		 p->tree_manager,
		 msgtag)) < 0)
      PVM_ERROR;
   if ((info = pvm_freebuf(s_bufid)) < 0) PVM_ERROR;
}

------------------------ purify's output -------------------------------------
      Purify instrumented pvm3/bin/SUN4/gpxlp (pid 4909 at Tue May 30 09:49:02 1995)
      Purify 3.0a SunOS 4.1, Copyright 1992-1994 Pure Software Inc.
      For contact information type: "purify -help"
      For TTY output, use the option "-windows=no"
      Command-line: pvm3/bin/SUN4/gpxlp 
      Options settings: -purify -cache-dir=/usr/u/ladanyi/purify/cache \
          -chain-length=10 \
          -linker=/home/ccopstaff/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3_U1/2.6.3/ld \
          -purify-home=/vol/packages/pure/bin/../purify-3.0a-sunos4 
      Purify licensed to Cornell University or CORNELL UNIVERSITY
      Purify checking enabled.
      UMR: Uninitialized memory read (12 times)
      This is occurring while in:
            mxfer          [libpvm3.a]
            mroute         [libpvm3.a]
            pvm_send       [libpvm3.a]
            send_finished_info [xlp.c:1686]
                     if ((info = pvm_pkint(&p->level, 1, 1)) < 0) PVM_ERROR;
                  }
                  
                     if ((info =
                  	pvm_send(
                  		 p->tree_manager,
            =>      		 msgtag)) < 0)
                        PVM_ERROR;
                  if ((info = pvm_freebuf(s_bufid)) < 0) PVM_ERROR;
               
                  if (p->iter_num == 0){
            prune          [xlp.c:1609]
            fathom_branch  [xlp.c:710]
            main           [xlp.c:129]
            start          [crt0.o]
      Reading 4 bytes from 0x8f393c in the heap.
      Address 0x8f393c is 28 bytes into a malloc'd block at 0x8f3920 of 104 bytes.
      This block was allocated from:
            malloc         [rtlib.o]
            calloc         [rtlib.o]
            umbuf_new      [libpvm3.a]
            pvm_mkbuf      [libpvm3.a]
            pvm_initsend   [libpvm3.a]
            send_finished_info [xlp.c:1676]
                  int s_bufid=0, info=0;
                  double total;
               
            =>    if ((s_bufid = pvm_initsend(PvmDataRaw)) < 0) PVM_ERROR;
               
                  if ((info = pvm_pkbyte((char *)(&p->comp_times),
                                         sizeof(node_times), 1)) < 0) PVM_ERROR;
            prune          [xlp.c:1609]
            fathom_branch  [xlp.c:710]
            main           [xlp.c:129]
            start          [crt0.o]
      UMR: Uninitialized memory read (12 times)
      Current file descriptors in use: 5
      Memory leaked: 0 bytes (0%); potentially leaked: 0 bytes (0%)
      Program exited with status code 1.
-- 
----------------------------------------------------------------------
| Laci Ladanyi           | God made one mistake when he created man: |
| ladanyi@cs.cornell.edu |     He wrote self-modifying code ...      |
----------------------------------------------------------------------

