|
From: Hoai T. <ho...@ya...> - 2004-07-13 15:28:17
|
Hi Tom, Nice to help me :) But, I just put the print command for debug. In my real code, there is a computing function there instead of cout. The similar result occurs warning an uninitialised data :( Any further hint ? Thank alot, Cheers, Hoai --- Tom Hughes <th...@cy...> wrote: > In message > <200...@we...> > Hoai Tran <ho...@ya...> wrote: > > > I'm a new guy in Valgrind. It's quite useful to > me. However, there is a > > case that I cannot explain. I have a segment of > code as following: > > > > double best; > > .... > > best = -1.0e20; > > cout << "BEst = " << best << endl; > > > > And Valgrind prints messages: > > > > ==12945== Syscall param write(buf) contains > uninitialised or unaddressable byte(s) > > ==12945== at 0x3C3F43E4: write (in > /lib/libc-2.2.5.so) > > ==12945== by 0x3C39B7C7: _IO_file_write (in > /lib/libc-2.2.5.so) > > ==12945== by 0x3C2E5E37: > sys_write__7filebufPCci (in > /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so) > > ==12945== by 0x3C39AE87: (within > /lib/libc-2.2.5.so) > > ==12945== by 0x3C39B92B: _IO_file_xsputn (in > /lib/libc-2.2.5.so) > > ==12945== by 0x3C2E5EAF: xsputn__7filebufPCci > (in /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so) > > ==12945== by 0x3C2E9871: (within > /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so) > > ==12945== by 0x3C2E9998: __ls__7ostreami (in > /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so) > > ==12945== by 0x80E64D2: > newOpenSubCount__13ABA_PARMASTER > (parmaster_opensubcount.cc:178) > > > > Please help me to work around the error. Or tell > me what exactly I must > > follow in order to use Valgrind correctly. Thank > alot. > > You are writing uninitialised data to cout at some > point. Note that > if cout is buffered then the actual problem write > may have occurred > some time before because valgrind will only report > the problem when > the write system call occurs as the buffer is > flushed, which may be > sometime later. > > Making the stream unbuffered can help make this sort > of problem easier > to track down. > > Tom > > -- > Tom Hughes (th...@cy...) > Software Engineer, Cyberscience Corporation > http://www.cyberscience.com/ > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & > Training. > Attend Black Hat Briefings & Training, Las Vegas > July 24-29 - > digital self defense, top technical experts, no > vendor pitches, > unmatched networking opportunities. Visit > www.blackhat.com > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail |