From: rudra on
as suggested by david, i have run the valgrind; but this is the first
time i ran it...so will anyone plz help me interpreting the output?
here is the copy of valgrind:

$ valgrind --leak-check=full ./irun <asr.in
==25145== Memcheck, a memory error detector.
==25145== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
al.
==25145== Using LibVEX rev 1732, a library for dynamic binary
translation.
==25145== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==25145== Using valgrind-3.2.3, a dynamic binary instrumentation
framework.
==25145== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
al.
==25145== For more details, rerun with: -v
==25145==
==25145== Conditional jump or move depends on uninitialised value(s)
==25145== at 0x807BADE: for__nml_lex (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x80786F9: for_read_seq_nml (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804D8E3: MAIN__ (main.f90:70)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
==25145==
==25145== Invalid read of size 4
==25145== at 0x806F6D9: for__add_to_lf_table (in /matsc/students/
Rudra/Recursion/ASR/irun)
==25145== by 0x809CBCE: for__open_proc. (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x8073032: for__open_default (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x808BE0D: for_write_seq_lis (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804D937: MAIN__ (main.f90:72)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
==25145== Address 0x4040BDC is 12 bytes inside a block of size 13
alloc'd
==25145== at 0x4005525: malloc (vg_replace_malloc.c:149)
==25145== by 0x8081B14: for__get_vm (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x809B8EB: for__open_proc. (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x8073032: for__open_default (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x808BE0D: for_write_seq_lis (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804D937: MAIN__ (main.f90:72)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
Concentration of Atom A = 0.600000000000000
Concentration of Atom B = 0.400000000000000
==25145==
==25145== Invalid read of size 4
==25145== at 0x806F6D9: for__add_to_lf_table (in /matsc/students/
Rudra/Recursion/ASR/irun)
==25145== by 0x809CBCE: for__open_proc. (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x80709DF: for_open (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804DA9D: MAIN__ (main.f90:81)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
==25145== Address 0x40413C4 is 44 bytes inside a block of size 46
alloc'd
==25145== at 0x4005525: malloc (vg_replace_malloc.c:149)
==25145== by 0x8081B14: for__get_vm (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x809B8EB: for__open_proc. (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x80709DF: for_open (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804DA9D: MAIN__ (main.f90:81)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
Reading AS-Map complete
==25145==
==25145== Invalid read of size 4
==25145== at 0x806F6D9: for__add_to_lf_table (in /matsc/students/
Rudra/Recursion/ASR/irun)
==25145== by 0x809CBCE: for__open_proc. (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x80709DF: for_open (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804DE3D: MAIN__ (main.f90:93)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
==25145== Address 0x4236F44 is 44 bytes inside a block of size 46
alloc'd
==25145== at 0x4005525: malloc (vg_replace_malloc.c:149)
==25145== by 0x8081B14: for__get_vm (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x809B8EB: for__open_proc. (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x80709DF: for_open (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804DE3D: MAIN__ (main.f90:93)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
Reading STRUCTURE MATRIX complete
==25145==
==25145== Invalid read of size 4
==25145== at 0x806F6D9: for__add_to_lf_table (in /matsc/students/
Rudra/Recursion/ASR/irun)
==25145== by 0x809CBCE: for__open_proc. (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x80709DF: for_open (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804E34B: MAIN__ (main.f90:119)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
==25145== Address 0x403FB2C is 44 bytes inside a block of size 47
alloc'd
==25145== at 0x4005525: malloc (vg_replace_malloc.c:149)
==25145== by 0x8081B14: for__get_vm (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x809B8EB: for__open_proc. (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x80709DF: for_open (in /matsc/students/Rudra/
Recursion/ASR/irun)
==25145== by 0x804E34B: MAIN__ (main.f90:119)
==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
ASR/irun)
Reading POTENTIAL PARAMETERS from POTPAR_A
Reading POTENTIAL PARAMETERS from POTPAR_B
==25145== Warning: client switching stacks? SP change: 0xBEFF4640 -->
0xBD68E350
==25145== to suppress, use: --max-stackframe=26632944 or
greater
==25145== Warning: client switching stacks? SP change: 0xBD68E350 -->
0xBBD28060
==25145== to suppress, use: --max-stackframe=26632944 or
greater
==25145== Warning: client switching stacks? SP change: 0xBBD28060 -->
0xBA3C1D70
==25145== to suppress, use: --max-stackframe=26632944 or
greater
==25145== further instances of this message will not be
shown.
==25145==
==25145== Invalid write of size 8
==25145== at 0x805AC2B: mhop_mp_hop_ (hop.f90:54)
==25145== Address 0xB8A5BA80 is on thread 1's stack
==25145== Can't extend stack to 0xB8A5B470 during signal delivery for
thread 1:
==25145== no stack segment
==25145==
==25145== Process terminating with default action of signal 11
(SIGSEGV)
==25145== Access not within mapped region at address 0xB8A5B470
==25145== at 0x805AC2B: mhop_mp_hop_ (hop.f90:54)
==25145==
==25145== Process terminating with default action of signal 11
(SIGSEGV)
==25145== Access not within mapped region at address 0xB8A5BA7C
==25145== at 0x4001214: _vgnU_freeres (vg_preloaded.c:56)
==25145==
==25145== ERROR SUMMARY: 11 errors from 6 contexts (suppressed: 16
from 1)
==25145== malloc/free: in use at exit: 38,174 bytes in 12 blocks.
==25145== malloc/free: 73,313 allocs, 73,301 frees, 150,415,620 bytes
allocated.
==25145== For counts of detected errors, rerun with: -v
==25145== searching for pointers to 12 not-freed blocks.
==25145== checked 5,282,228 bytes.
==25145==
==25145== LEAK SUMMARY:
==25145== definitely lost: 0 bytes in 0 blocks.
==25145== possibly lost: 0 bytes in 0 blocks.
==25145== still reachable: 38,174 bytes in 12 blocks.
==25145== suppressed: 0 bytes in 0 blocks.
==25145== Reachable blocks (those to which a pointer was found) are
not shown.
==25145== To see them, rerun with: --leak-check=full --show-
reachable=yes
Segmentation fault
From: dpb on
rudra wrote:
> as suggested by david, i have run the valgrind; but this is the first
> time i ran it...so will anyone plz help me interpreting the output?
....

Well, you're one cycle ahead of me, but let's see...

> $ valgrind --leak-check=full ./irun <asr.in
....

> ==25145== Conditional jump or move depends on uninitialised value(s)
> ==25145== at 0x807BADE: for__nml_lex (in /matsc/students/Rudra/
> Recursion/ASR/irun)
> ==25145== by 0x80786F9: for_read_seq_nml (in /matsc/students/Rudra/
> Recursion/ASR/irun)
> ==25145== by 0x804D8E3: MAIN__ (main.f90:70)
> ==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
> ASR/irun)

That seems to indicate that you used an uninitialized variable at line
70 in the main program as starters...

> ==25145==
> ==25145== Invalid read of size 4
> ==25145== at 0x806F6D9: for__add_to_lf_table (in /matsc/students/
> Rudra/Recursion/ASR/irun)
> ==25145== by 0x809CBCE: for__open_proc. (in /matsc/students/Rudra/
> Recursion/ASR/irun)
> ==25145== by 0x8073032: for__open_default (in /matsc/students/Rudra/
> Recursion/ASR/irun)
> ==25145== by 0x808BE0D: for_write_seq_lis (in /matsc/students/Rudra/
> Recursion/ASR/irun)
> ==25145== by 0x804D937: MAIN__ (main.f90:72)
> ==25145== by 0x8049D40: main (in /matsc/students/Rudra/Recursion/
> ASR/irun)
> ==25145== Address 0x4040BDC is 12 bytes inside a block of size 13
> alloc'd

And this seems to indicate you then tried to reference a default REAL or
INTEGER at an offset of 12 bytes inside a UDT two lines later. That
would be the fourth member it would seem.

I'd go look in those two areas first and see what I could see and then
go from there...

--
From: dpb on
dpb wrote:
....

> That seems to indicate that you used an uninitialized variable at line
> 70 in the main program as starters...
....

Oh, another thought that instigated...have you compiled w/ all available
warnings on and eliminated all of them that could be of significance? I
don't know proper switch syntax, but would be at least a chance the
uninitialized variable (assuming that is a correct diagnosis) would have
thrown a warning during compilation. Compiler can't catch all possible
cases, of course, but any it does should certainly be corrected before
going on.

--