|
From: <bv...@bv...> - 2004-08-06 19:14:38
|
I am using valgrind on a g77 program and am getting
some peculiar results:
Cccccccccccccccccccccccccccccccccccccccccc
program memty
integer i
i=360
call fsub(i)
end
C
subroutine fsub(i)
integer i
double complex x(i,i)
x(i,i)=complex(0D0,0D0)
end
Ccccccccccccccccccccccccccccccccccccccccc
Valgrind gives an error of the form:
==12420== Invalid write of size 8
==12420== at 0x8048671: fsub_ (memty.f:10)
==12420== by 0x80486C5: main (../../../../gcc-3.1/libf2c/libF77/main.c:61)
==12420== Address 0x52BFE8A0 is on thread 1's stack
==12420==
==12420== Invalid write of size 8
==12420== at 0x8048679: fsub_ (memty.f:10)
==12420== by 0x80486C5: main (../../../../gcc-3.1/libf2c/libF77/main.c:61)
==12420== Address 0x52BFE8A8 is on thread 1's stack
Some more info:
bvds> uname -a
Linux bvds 2.4.25 #1 SMP Sat Mar 20 15:34:02 EST 2004 i686 i686 i386 GNU/Linux
bvds> g77 --version
GNU Fortran (GCC) 3.3.2
bvds> valgrind --version
valgrind-2.1.2
I see the same behavior in valgrind-2.0.0.
This only happens for complex arrays.
if I use the g77 flag -femulate-complex, then there is one error.
Any ideas?
Brett van de Sande
|
|
From: Tom H. <th...@cy...> - 2004-08-06 19:57:17
|
In message <200...@bv...>
<bv...@bv...> wrote:
> Valgrind gives an error of the form:
>
> ==12420== Invalid write of size 8
> ==12420== at 0x8048671: fsub_ (memty.f:10)
> ==12420== by 0x80486C5: main (../../../../gcc-3.1/libf2c/libF77/main.c:61)
> ==12420== Address 0x52BFE8A0 is on thread 1's stack
> ==12420==
> ==12420== Invalid write of size 8
> ==12420== at 0x8048679: fsub_ (memty.f:10)
> ==12420== by 0x80486C5: main (../../../../gcc-3.1/libf2c/libF77/main.c:61)
> ==12420== Address 0x52BFE8A8 is on thread 1's stack
If you run with -v you will see this warning:
==9495== Warning: thread 1 switching stacks? %esp: 0x52BFEA10 --> 0x52A04610
What's happening is that the very large array is using about 1Mb of
stack space and that is confusing valgrind into thinking that the
thread has switched to a different stack so it doesn't mark all that
space as writable and then you get invalid write warnings.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|