From: rudra on
when I am running my fortran 90 code, i am getting an unusual problem.
While the code is compiling very well in intel compiler, its showing
following error while compiling with gfortran just before the end of
run:
######### calculation over
*** glibc detected *** /matsc/students/Rudra/Recursion/Real/run.out:
double free or corruption (out): 0xb7f79008 ***
======= Backtrace: =========
/lib/libc.so.6[0x5efac1]
/lib/libc.so.6(cfree+0x90)[0x5f30f0]
/usr/lib/libgfortran.so.1(_gfortran_internal_free+0x21)[0x24e0c1]
/matsc/students/Rudra/Recursion/Real/run.out[0x804a075]
/matsc/students/Rudra/Recursion/Real/run.out[0x804af1b]
/matsc/students/Rudra/Recursion/Real/run.out[0x804af47]
/lib/libc.so.6(__libc_start_main+0xe0)[0x59c390]
/matsc/students/Rudra/Recursion/Real/run.out[0x8048751]
======= Memory map: ========
00110000-00111000 r-xp 00110000 00:00 0 [vdso]
00242000-002c1000 r-xp 00000000 08:07 4259911 /usr/lib/libgfortran.so.
1.0.0
002c1000-002c2000 rwxp 0007e000 08:07 4259911 /usr/lib/libgfortran.so.
1.0.0
00567000-00582000 r-xp 00000000 08:07 4859005 /lib/ld-2.7.so
00582000-00583000 r-xp 0001a000 08:07 4859005 /lib/ld-2.7.so
00583000-00584000 rwxp 0001b000 08:07 4859005 /lib/ld-2.7.so
00586000-006d9000 r-xp 00000000 08:07 2457626 /lib/libc-2.7.so
006d9000-006db000 r-xp 00153000 08:07 2457626 /lib/libc-2.7.so
006db000-006dc000 rwxp 00155000 08:07 2457626 /lib/libc-2.7.so
006dc000-006df000 rwxp 006dc000 00:00 0
006e1000-00708000 r-xp 00000000 08:07 2457630 /lib/libm-2.7.so
00708000-00709000 r-xp 00026000 08:07 2457630 /lib/libm-2.7.so
00709000-0070a000 rwxp 00027000 08:07 2457630 /lib/libm-2.7.so
00aaa000-00ab5000 r-xp 00000000 08:07 2457634 /lib/
libgcc_s-4.1.2-20070925.so.1
00ab5000-00ab6000 rwxp 0000a000 08:07 2457634 /lib/
libgcc_s-4.1.2-20070925.so.1
08048000-0804c000 r-xp 00000000 00:11 5112713 /matsc/students/Rudra/
Recursion/Real/run.out
0804c000-0804d000 rw-p 00003000 00:11 5112713 /matsc/students/Rudra/
Recursion/Real/run.out
0906e000-090b2000 rw-p 0906e000 00:00 0
b7e00000-b7e21000 rw-p b7e00000 00:00 0
b7e21000-b7f00000 ---p b7e21000 00:00 0
b7f79000-b7fc1000 rw-p b7f79000 00:00 0
bf89f000-bf8b4000 rw-p bffea000 00:00 0 [stack]

Program received signal SIGABRT, Aborted.
0x00110402 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install gcc.i386
glibc.i686
(gdb) backtrace
#0 0x00110402 in __kernel_vsyscall ()
#1 0x005af690 in raise () from /lib/libc.so.6
#2 0x005b0f91 in abort () from /lib/libc.so.6
#3 0x005e79eb in __libc_message () from /lib/libc.so.6
#4 0x005efac1 in _int_free () from /lib/libc.so.6
#5 0x005f30f0 in free () from /lib/libc.so.6
#6 0x0024e0c1 in _gfortran_internal_free () from /usr/lib/
libgfortran.so.1
#7 0x0804a075 in coefficient_ (istart=(a)0xbf8b1eb4, lorbit=(a)0xbf8b1eac,
nrec=(a)0xbf8b1ea8, nsite=(a)0xbf8b1efc,
nmax=(a)0xbf8b1eb0, nn=(a)0xbf8b1ef8, cmat=0xbf8b1e50, dmat=0xbf8b1e08) at
coeff.f90:5
#8 0x0804af1b in MAIN__ () at main.f90:64
#9 0x0804af47 in main ()
(gdb)

can anybody tell me whats wrong? gfortran is working well elsewhere
From: rudra on
one more problem found......if i am using a single program(i.e.
without anysubroutine) the program is running fine. I have used the
same program, no change in calculatin...just all subroutines are puted
in main.
as soon as i am trying for a modularize version, its failling.
From: rudra on
as suggested by tobious, i run valgrind with the following output. But
this is the first time i am even hearing the name valgrind......
what i can do?
valgrind --leak-check=yes ./run.out
==23137== Memcheck, a memory error detector.
==23137== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
al.
==23137== Using LibVEX rev 1732, a library for dynamic binary
translation.
==23137== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==23137== Using valgrind-3.2.3, a dynamic binary instrumentation
framework.
==23137== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
al.
==23137== For more details, rerun with: -v
==23137==

==23137== Invalid read of size 8
==23137== at 0x8049806: coefficient_ (coeff.f90:93)
==23137== by 0x804AF26: MAIN__ (main.f90:64)
==23137== by 0x804AF56: main (in /matsc/students/Rudra/Recursion/
Real/run.out)
==23137== Address 0x40E3F70 is 0 bytes after a block of size 285,768
alloc'd
==23137== at 0x4005525: malloc (vg_replace_malloc.c:149)
==23137== by 0x24E34C: (within /usr/lib/libgfortran.so.1.0.0)
==23137== by 0x24E468: (within /usr/lib/libgfortran.so.1.0.0)
==23137== by 0x24E4D0: _gfortran_internal_malloc (in /usr/lib/
libgfortran.so.1.0.0)
==23137== by 0x804899E: coefficient_ (coeff.f90:5)
==23137== by 0x804AF26: MAIN__ (main.f90:64)
==23137== by 0x804AF56: main (in /matsc/students/Rudra/Recursion/
Real/run.out)
==23137==
==23137== Invalid write of size 8
==23137== at 0x804980F: coefficient_ (coeff.f90:93)
==23137== by 0x804AF26: MAIN__ (main.f90:64)
==23137== by 0x804AF56: main (in /matsc/students/Rudra/Recursion/
Real/run.out)
==23137== Address 0x40E3F70 is 0 bytes after a block of size 285,768
alloc'd
==23137== at 0x4005525: malloc (vg_replace_malloc.c:149)
==23137== by 0x24E34C: (within /usr/lib/libgfortran.so.1.0.0)
==23137== by 0x24E468: (within /usr/lib/libgfortran.so.1.0.0)
==23137== by 0x24E4D0: _gfortran_internal_malloc (in /usr/lib/
libgfortran.so.1.0.0)
==23137== by 0x804899E: coefficient_ (coeff.f90:5)
==23137== by 0x804AF26: MAIN__ (main.f90:64)
==23137== by 0x804AF56: main (in /matsc/students/Rudra/Recursion/
Real/run.out)
calculation done for orbital 1
calculation done for orbital 2
calculation done for orbital 3
calculation done for orbital 4
calculation done for orbital 5
calculation done for orbital 6
calculation done for orbital 7
calculation done for orbital 8
calculation done for orbital 9
calculation over
==23137==
==23137== ERROR SUMMARY: 6480 errors from 2 contexts (suppressed: 15
from 1)
==23137== malloc/free: in use at exit: 0 bytes in 0 blocks.
==23137== malloc/free: 4,397 allocs, 4,397 frees, 2,269,164 bytes
allocated.
==23137== For counts of detected errors, rerun with: -v
==23137== All heap blocks were freed -- no leaks are possible.





From: Gerry Ford on

"rudra" <bnrj.rudra(a)gmail.com> wrote in message
news:2f090017-b352-4eaf-99e8-c1002c092610(a)s19g2000prg.googlegroups.com...
> as suggested by tobious, i run valgrind with the following output. But
> this is the first time i am even hearing the name valgrind......
> what i can do?
> valgrind --leak-check=yes ./run.out
> ==23137== malloc/free: in use at exit: 0 bytes in 0 blocks.
> ==23137== malloc/free: 4,397 allocs, 4,397 frees, 2,269,164 bytes
> allocated.
> ==23137== For counts of detected errors, rerun with: -v
> ==23137== All heap blocks were freed -- no leaks are possible.

If this isn't a core dump, then I don't know what is.

One thing nice about fortran is that it knows nothing of malloc.

I think you want to be in comp.unix.something. Actually what is that ng
called?

--

"I am waiting for them to prove that God is really American."

~~ Lawrence Ferlinghetti


From: fj on
On 1 avr, 05:50, rudra <bnrj.ru...(a)gmail.com> wrote:
> as suggested by tobious, i run valgrind with the following output. But
> this is the first time i am even hearing the name valgrind......
> what i can do?
> valgrind --leak-check=yes ./run.out
> ==23137== Memcheck, a memory error detector.
> ==23137== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
> al.
> ==23137== Using LibVEX rev 1732, a library for dynamic binary
> translation.
> ==23137== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
> ==23137== Using valgrind-3.2.3, a dynamic binary instrumentation
> framework.
> ==23137== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
> al.
> ==23137== For more details, rerun with: -v
> ==23137==
>
> ==23137== Invalid read of size 8
> ==23137== at 0x8049806: coefficient_ (coeff.f90:93)
> ==23137== by 0x804AF26: MAIN__ (main.f90:64)
> ==23137== by 0x804AF56: main (in /matsc/students/Rudra/Recursion/
> Real/run.out)
> ==23137== Address 0x40E3F70 is 0 bytes after a block of size 285,768
> alloc'd
> ==23137== at 0x4005525: malloc (vg_replace_malloc.c:149)
> ==23137== by 0x24E34C: (within /usr/lib/libgfortran.so.1.0.0)
> ==23137== by 0x24E468: (within /usr/lib/libgfortran.so.1.0.0)
> ==23137== by 0x24E4D0: _gfortran_internal_malloc (in /usr/lib/
> libgfortran.so.1.0.0)
> ==23137== by 0x804899E: coefficient_ (coeff.f90:5)
> ==23137== by 0x804AF26: MAIN__ (main.f90:64)
> ==23137== by 0x804AF56: main (in /matsc/students/Rudra/Recursion/
> Real/run.out)
> ==23137==
> ==23137== Invalid write of size 8
> ==23137== at 0x804980F: coefficient_ (coeff.f90:93)
> ==23137== by 0x804AF26: MAIN__ (main.f90:64)
> ==23137== by 0x804AF56: main (in /matsc/students/Rudra/Recursion/
> Real/run.out)
> ==23137== Address 0x40E3F70 is 0 bytes after a block of size 285,768
> alloc'd
> ==23137== at 0x4005525: malloc (vg_replace_malloc.c:149)
> ==23137== by 0x24E34C: (within /usr/lib/libgfortran.so.1.0.0)
> ==23137== by 0x24E468: (within /usr/lib/libgfortran.so.1.0.0)
> ==23137== by 0x24E4D0: _gfortran_internal_malloc (in /usr/lib/
> libgfortran.so.1.0.0)
> ==23137== by 0x804899E: coefficient_ (coeff.f90:5)
> ==23137== by 0x804AF26: MAIN__ (main.f90:64)
> ==23137== by 0x804AF56: main (in /matsc/students/Rudra/Recursion/
> Real/run.out)
> calculation done for orbital 1
> calculation done for orbital 2
> calculation done for orbital 3
> calculation done for orbital 4
> calculation done for orbital 5
> calculation done for orbital 6
> calculation done for orbital 7
> calculation done for orbital 8
> calculation done for orbital 9
> calculation over
> ==23137==
> ==23137== ERROR SUMMARY: 6480 errors from 2 contexts (suppressed: 15
> from 1)
> ==23137== malloc/free: in use at exit: 0 bytes in 0 blocks.
> ==23137== malloc/free: 4,397 allocs, 4,397 frees, 2,269,164 bytes
> allocated.
> ==23137== For counts of detected errors, rerun with: -v
> ==23137== All heap blocks were freed -- no leaks are possible.

Look at the instruction coeff.f90:93 carefully : the problem occured
there ! But the origin of the problem is possibly somewhere else (a
wrong definition of an argument passed to the routine coef for
instance).

And please, as other guys said, show us your code (at least the
variable definition, the call statement to coef ...) else we cannot
help you efficiently.