On 9/3/21 12:31 PM, Eric Chamberland wrote:
Hi,
I have a simple test and valgrind seems to not see the error:
cat fread.cc && clang++ -o fread fread.cc && valgrind ./fread
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char ** argv){
int lA {1};
FILE * f = fopen ( argv[0] , "rb" );
fread(&lA,2*sizeof(int),1,f);
std::cout << "Hello: "<< lA << std::endl;
return 0;
}
This report is interesting only because it is a bad example:
it does not specify what is the supposed error.
If you don't say what you believe it is, then how are valgrind developers to
know?
Besides, the "memcheck error" is covered in the valgrind FAQ.
Look it up in paragraph "4.6. Why doesn't Memcheck find ..."
The second and third errors are the logic errors of not checking
the return value of fopen and fread.
The fourth error is not documenting the expected invocation command line.
The fifth error is not checking argc.
The sixth error is not documenting the expected format of the input file.
Are you sure that you really are a programmer?
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users