Re: [fpc-pascal] valgrind: "invalid read"
> -Message d'origine- > De : fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal- > boun...@lists.freepascal.org] De la part de Jonas Maebe > Envoyé : jeudi 4 juin 2015 19:51 > À : FPC-Pascal users discussions > Objet : Re: [fpc-pascal] valgrind: "invalid read" > > > David Emerson wrote on Thu, 04 Jun 2015: > > > I have just started using valgrind, and I was surprised that I got a > > lot of errors, particularly in places that look like clean code. So > > I whittled things down and created a test program. Here is the error > > I am seeing (I've removed the procid, ==11180==): > > > > Invalid read of size 16 > >at 0x401727: SYSTEM_INDEXBYTE$formal$INT64$BYTE$$INT64 (in > > /Docs/fpc/test/vg_stringlist_const_error) > > It's a false positive. You can create valgrind suppression files to > filter out such false positives. Someone once started a generic > suppression file for FPC > (http://svn.freepascal.org/svn/fpcbuild/trunk/install/unix/valgrind- > fpc.supp > ), but as you can see it's far from complete. You can even get > Valgrind to generate the suppression itself when it prints out errors: > http://valgrind.org/docs/manual/manual-core.html (search for > --gen-suppressions=yes). Hi Jonas, I am not sure I understand why it is a false positive: The read size is 16, at offset 16, which make it read up to position 32, while only 30 byte were allocated... What is wrong in my analysis above? Pierre ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] valgrind: "invalid read"
Pierre Free Pascal wrote on Fri, 05 Jun 2015: I am not sure I understand why it is a false positive: The read size is 16, at offset 16, which make it read up to position 32, while only 30 byte were allocated... What is wrong in my analysis above? These kinds of algorithms don't actually use the bytes read past the end of the data. They will also only read data from aligned addresses, so that the extra data cannot cross a page boundary and hence cannot cause a segmentation fault. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] valgrind: "invalid read"
> -Message d'origine- > De : fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal- > boun...@lists.freepascal.org] De la part de Jonas Maebe > Envoyé : vendredi 5 juin 2015 10:52 > À : FPC-Pascal users discussions > Objet : Re: [fpc-pascal] valgrind: "invalid read" > > > Pierre Free Pascal wrote on Fri, 05 Jun 2015: > > > > I am not sure I understand why it is a false positive: > > > > The read size is 16, at offset 16, which make it read up to position > 32, > > while only 30 byte were allocated... > > What is wrong in my analysis above? > > These kinds of algorithms don't actually use the bytes read past the > end of the data. They will also only read data from aligned addresses, > so that the extra data cannot cross a page boundary and hence cannot > cause a segmentation fault. OK, thanks for the explanation, it was indeed the page boundary problem I was afraid of. Pierre ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal