Randall Mackie <[email protected]> writes: > The attached small program, basically a call to PetscPrintf, gives the > following valgrind errors: > > [rmackie ~/tst_petsc_problem] ./cmd_test > ==24812== Invalid read of size 1 > ==24812== at 0x4C2E500: __GI_strncpy (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24812== by 0x4EF5B4D: PetscStrncpy (str.c:335) > ==24812== by 0x4F334E0: petscprintf_ (zmprintf.c:54) > ==24812== by 0x400F28: MAIN__ (test.F90:11) > ==24812== by 0x400F9A: main (test.F90:16) > ==24812== Address 0x8cef9bb is 0 bytes after a block of size 11 alloc'd
Barry, this looks like you making PetscStrncpy behave unlike strncpy. https://bitbucket.org/petsc/petsc/commits/ff32304b6c2c50401fe7ef46e45693a4318e17f0 I'll note that I dislike having functions named after standard C functions, but with different behavior (e.g., PetscStrcmp and PetscStrncpy). If you really want these different semantics, I'd rather have different names. > ==24812== at 0x4C2AB80: malloc (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24812== by 0x6828BB4: ??? (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24812== by 0x68FBC97: _gfortran_string_trim (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24812== by 0x400EFD: MAIN__ (test.F90:11) > ==24812== by 0x400F9A: main (test.F90:16) > ==24812== > > > The program was compiled with PETSc V3.5.1 and --download-mpich. > > The same program compiled with V3.4.4 and --download-mpich does not give > these errors. > > It seems like an innocuous error, and I can certainly create a suppression > file for it, but I thought I'd report it anyway. > I get the same error on 2 different systems and I've tried 3 different > gfortran versions, all with the same result. > > Program, configure commands, etc, attached. > > Randy M. > > > [rmackie ~/tst_petsc_problem] ./cmd_test > ==24812== Invalid read of size 1 > ==24812== at 0x4C2E500: __GI_strncpy (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24812== by 0x4EF5B4D: PetscStrncpy (str.c:335) > ==24812== by 0x4F334E0: petscprintf_ (zmprintf.c:54) > ==24812== by 0x400F28: MAIN__ (test.F90:11) > ==24812== by 0x400F9A: main (test.F90:16) > ==24812== Address 0x8cef9bb is 0 bytes after a block of size 11 alloc'd > ==24812== at 0x4C2AB80: malloc (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24812== by 0x6828BB4: ??? (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24812== by 0x68FBC97: _gfortran_string_trim (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24812== by 0x400EFD: MAIN__ (test.F90:11) > ==24812== by 0x400F9A: main (test.F90:16) > ==24812== > ==24814== Invalid read of size 1 > ==24814== at 0x4C2E500: __GI_strncpy (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24814== by 0x4EF5B4D: PetscStrncpy (str.c:335) > ==24814== by 0x4F334E0: petscprintf_ (zmprintf.c:54) > ==24814== by 0x400F28: MAIN__ (test.F90:11) > ==24814== by 0x400F9A: main (test.F90:16) > ==24814== Address 0x8cef5ab is 0 bytes after a block of size 11 alloc'd > ==24814== at 0x4C2AB80: malloc (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24814== by 0x6828BB4: ??? (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24814== by 0x68FBC97: _gfortran_string_trim (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24814== by 0x400EFD: MAIN__ (test.F90:11) > ==24814== by 0x400F9A: main (test.F90:16) > ==24814== > ==24815== Invalid read of size 1 > ==24815== at 0x4C2E500: __GI_strncpy (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24815== by 0x4EF5B4D: PetscStrncpy (str.c:335) > ==24815== by 0x4F334E0: petscprintf_ (zmprintf.c:54) > ==24815== by 0x400F28: MAIN__ (test.F90:11) > ==24815== by 0x400F9A: main (test.F90:16) > ==24815== Address 0x8cef51b is 0 bytes after a block of size 11 alloc'd > ==24815== at 0x4C2AB80: malloc (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24815== by 0x6828BB4: ??? (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24815== by 0x68FBC97: _gfortran_string_trim (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24815== by 0x400EFD: MAIN__ (test.F90:11) > ==24815== by 0x400F9A: main (test.F90:16) > ==24815== > ==24813== Invalid read of size 1 > ==24813== at 0x4C2E500: __GI_strncpy (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24813== by 0x4EF5B4D: PetscStrncpy (str.c:335) > ==24813== by 0x4F334E0: petscprintf_ (zmprintf.c:54) > ==24813== by 0x400F28: MAIN__ (test.F90:11) > ==24813== by 0x400F9A: main (test.F90:16) > ==24813== Address 0x8cef51b is 0 bytes after a block of size 11 alloc'd > ==24813== at 0x4C2AB80: malloc (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==24813== by 0x6828BB4: ??? (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24813== by 0x68FBC97: _gfortran_string_trim (in > /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) > ==24813== by 0x400EFD: MAIN__ (test.F90:11) > ==24813== by 0x400F9A: main (test.F90:16) > ==24813==
pgpUF0Ks9Lqjg.pgp
Description: PGP signature
