gfortran problem
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
gfortran problem         


Author: rudra
Date: Mar 31, 2008 09:52

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 ...
Show full article (3.02Kb)
27 Comments
Re: gfortran problem         


Author: Tobias Burnus
Date: Mar 31, 2008 10:05

On Mar 31, 6:52 pm, rudra gmail.com> wrote:
> *** glibc detected *** /matsc/students/Rudra/Recursion/Real/run.out:
> double free or corruption (out): 0xb7f79008 ***
[...]
> #6 0x0024e0c1 in _gfortran_internal_free () from /usr/lib/
> libgfortran.so.1
> #7 0x0804a075 in coefficient_ (istart=@0xbf8b1eb4, lorbit=@0xbf8b1eac,
> nrec=@0xbf8b1ea8, nsite=@0xbf8b1efc,
> nmax=@0xbf8b1eb0, nn=@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

Not without further information such as knowing how "coefficient" in
coeff.f90 looks like. If you use POINTER then it could well be a
programming error, if not it could be a gfortran bug.
Show full article (1.22Kb)
no comments
Re: gfortran problem         


Author: rudra
Date: Mar 31, 2008 10:12

On Mar 31, 10:05 pm, Tobias Burnus wrote:
> On Mar 31, 6:52 pm, rudra gmail.com> wrote:
>
>> *** glibc detected *** /matsc/students/Rudra/Recursion/Real/run.out:
>> double free or corruption (out): 0xb7f79008 ***
> [...]
>> #6 0x0024e0c1 in _gfortran_internal_free () from /usr/lib/
>> libgfortran.so.1
>> #7 0x0804a075 in coefficient_ (istart=@0xbf8b1eb4, lorbit=@0xbf8b1eac,
>> nrec=@0xbf8b1ea8, nsite=@0xbf8b1efc,
>> nmax=@0xbf8b1eb0, nn=@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
>
> Not without further information such as knowing how "coefficient" in
> coeff.f90 looks like. If you use POINTER then it could well be a ...
Show full article (2.07Kb)
no comments
Re: gfortran problem         


Author: nospam
Date: Mar 31, 2008 10:46

rudra gmail.com> wrote:
> On Mar 31, 10:05 pm, Tobias Burnus wrote:
>> On Mar 31, 6:52 pm, rudra gmail.com> wrote:
>>
>>> can anybody tell me whats wrong? gfortran is working well elsewhere
>>
>> Not without further information such as knowing how "coefficient" in
>> coeff.f90 looks like. If you use POINTER then it could well be a
>> programming error, if not it could be a gfortran bug.
> its not a pointer, just an array.
...

I doubt you are going to get much useful help without showing the code.
Tobias suggested the possibility that coefficient might be a pointer as
just one possibility, but there are many others. It could even be from
other apparently unrelated places in the code. I dion't even see enough
here on which to base a speculation. That the code "works elsewhere"
isn't necessarily indicative of much.
Show full article (1.22Kb)
no comments
Re: gfortran problem         


Author: Greg Lindahl
Date: Mar 31, 2008 14:42

In article i7g2000prf.googlegroups.com>,
rudra gmail.com> wrote:
>*** glibc detected *** /matsc/students/Rudra/Recursion/Real/run.out:
>double free or corruption (out): 0xb7f79008 ***

This is often caused by overrunning the beginning or end of an
allocated array. Valgrind helps find these.

The Intel compiler uses a different method of getting the memory for
allocated arays, so it might not cause this bug to be exposed.

-- greg
no comments
Re: gfortran problem         


Author: rudra
Date: Mar 31, 2008 20:30

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.
no comments
Re: gfortran problem         


Author: rudra
Date: Mar 31, 2008 20:50

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/...
Show full article (2.83Kb)
no comments
Re: gfortran problem         


Author: Gerry Ford
Date: Mar 31, 2008 21:29

"rudra" gmail.com> wrote in message
news:2f090017-b352-4eaf-99e8-c1002c092610@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
no comments
Re: gfortran problem         


Author: fj
Date: Mar 31, 2008 23:53

On 1 avr, 05:50, rudra 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) ...
Show full article (3.38Kb)
no comments
Re: gfortran problem         


Author: Greg Lindahl
Date: Apr 1, 2008 00:12

>==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

At line 93 of coeff.f90, you read off the end of the array
coefficient(). You allocated it in line 5 of coeff.f90.
>==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

This is the same thing, only this time you wrote it instead of reading
it. Boom! You have corrupted memory.

If you run with the Intel compiler you'll probably see the same thing,
only you get lucky and don't corrupt the malloc arena. So you think
your program gives the right output... but...
Show full article (1.01Kb)
no comments
1 2 3