It was not perfect - some bugs in it.
But OK it still works.
After some update to gcc4.0 and glibc a could not start my program without
SEG FAULT.
If i try to debug it to find out where the bug is it set me the break point just
after the begining of main() function.
OK. I have commented complete source just left return 0; at the end.
It works. Then I add more and more source to the working code to get know
where it breaks. And I find quite normal code:
Code: Select all
{
FILE *out = fopen("source.ascii","wb");
for(int i = 0; i < dim; i++)
{
fprintf(out, "%.8e\t%.8e\n", x_dat[i], y_dat[i]);
}
fclose(out);
}Then I switched back to gcc 3.4.4 and glibc 2.3.5 - it was OK before with them.
Nothing is changing.
I tried to compile glibc with old compiler - it does not help.
Then I found info about valgrind - good tool for debug
and what it does says to me:
Code: Select all
and many times before. ->
-> ==18263== Conditional jump or move depends on uninitialised value(s)
==18263== at 0x1B8EDE89: (within /lib/ld-2.3.5.so)
==18263== by 0x1B8E6AC2: (within /lib/ld-2.3.5.so)
==18263== by 0x1B8F4909: (within /lib/ld-2.3.5.so)
==18263== by 0x756E694B: ???
==18263==
==18263== Conditional jump or move depends on uninitialised value(s)
==18263== at 0x1B8EDFC0: (within /lib/ld-2.3.5.so)
==18263== by 0x1B8E6AC2: (within /lib/ld-2.3.5.so)
==18263== by 0x1B8F4909: (within /lib/ld-2.3.5.so)
==18263== by 0x756E694B: ???
==18263==
==18263== Invalid read of size 1
==18263== at 0x1BA5C832: vfprintf (in /lib/libc-2.3.5.so)
==18263== by 0x1BA64F02: fprintf (in /lib/libc-2.3.5.so)
==18263== by 0x1BA34F36: __libc_start_main (in /lib/libc-2.3.5.so)
==18263== Address 0x46 is not stack'd, malloc'd or (recently) free'd
==18263==
==18263== Process terminating with default action of signal 11 (SIGSEGV)
==18263== Access not within mapped region at address 0x46
==18263== at 0x1BA5C832: vfprintf (in /lib/libc-2.3.5.so)
==18263== by 0x1BA64F02: fprintf (in /lib/libc-2.3.5.so)
==18263== by 0x1BA34F36: __libc_start_main (in /lib/libc-2.3.5.so)
==18263==
==18263== ERROR SUMMARY: 22 errors from 8 contexts (suppressed: 0 from 0)
==18263== malloc/free: in use at exit: 22416 bytes in 2 blocks.
==18263== malloc/free: 5 allocs, 3 frees, 26182 bytes allocated.
==18263== For counts of detected errors, rerun with: -v
==18263== searching for pointers to 2 not-freed blocks.
==18263== checked 161680 bytes.
==18263==
==18263== LEAK SUMMARY:
==18263== definitely lost: 0 bytes in 0 blocks.
==18263== possibly lost: 0 bytes in 0 blocks.
==18263== still reachable: 22416 bytes in 2 blocks.
==18263== suppressed: 0 bytes in 0 blocks.
==18263== Reachable blocks (those to which a pointer was found) are not shown.
==18263== To see them, rerun with: --show-reachable=yes
Segmentation fault
Code: Select all
==18263== Conditional jump or move depends on uninitialised value(s)
==18263== at 0x1B8EDE89: (within /lib/ld-2.3.5.so)
==18263== by 0x1B8E6AC2: (within /lib/ld-2.3.5.so)
==18263== by 0x1B8F4909: (within /lib/ld-2.3.5.so)
==18263== by 0x756E694B: ???
but program still works in such case.
I'm quite sure that my code is more or less right.
There are some other errors - but they doesn't related to this problem.
Thanks in advance!

