help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory allocation bug in g++-4.1.2 and glibc


From: alikin
Subject: Re: memory allocation bug in g++-4.1.2 and glibc
Date: 20 Apr 2007 19:38:06 -0700
User-agent: G2/1.0

Hi Paul,
Thanks for the useful information. My code has essentially two parts.
The first part generates some data which is then used to call a
minimiser function which is not written by me and it has been used
fairly largely under Windows without any problem. After reading your
email I seperated those parts by saving the data that caused the glibc
memory corruption error and then running a small program which read
the data and called the miniser, in this case, the program does not
crash! but valgrind returns lots of errors such as:
Use of uninitialised value of size 4
Conditional jump or move depends on uninitialised value(s)
Syscall param write(buf) points to uninitialised byte(s)
 for a few lines of code inside that minimiser (a more detailed bit of
valgrind's output is at the bottom of this email). I have no idea why
this is not an issue under windows and how important those errors are
and is that why I have heap corruption?


> Version of gcc is probably completely irrelevant.
> What is the version of glibc?

I upgraded from 2.3 to 2.5-2



>
> > I did a bit of search and apparently this problem is common in g++4.*
> > but g++-3.4 works fine.
>
> The references I find say "crashes under gcc-4 with stack checking enabled".
> That's not a problem in gcc-4, it's a problem with user code having
> stack overflows.
>
> > Any help on how to get g++-4.1.2 work properly is greatly appreciated.
>
> Look for a bug in your code?
> Get glibc that is compiled without -fomit-fp ?

I am not sure if that comes by default with apt-get install? Is there
a way to check/change its value  when installing glibc using apt-get
in Debian?
Cheers,
Alikin,
P.S. Piece of Valgrind output:

==4221== Use of uninitialised value of size 4
==4221==    at 0x42D4BC6: (within /lib/libc-2.5.so)
==4221==    by 0x42DBB68: (within /lib/libc-2.5.so)
==4221==    by 0x42DCAD3: __printf_fp (in /lib/libc-2.5.so)
==4221==    by 0x42D82DB: vfprintf (in /lib/libc-2.5.so)
==4221==    by 0x42E08C2: printf (in /lib/libc-2.5.so)
==4221==    by 0x804FCE1:
MRFEnergy<TypeGeneral>::Minimize_TRW_S(MRFEnergy<TypeGeneral>::Options&,
double&, double&) (minimize.cpp:129)
==4221==    by 0x80491A6: main (testtrw.cpp:88)
==4221==
==4221== Use of uninitialised value of size 4
==4221==    at 0x42D4BCC: (within /lib/libc-2.5.so)
==4221==    by 0x42DBB68: (within /lib/libc-2.5.so)
==4221==    by 0x42DCAD3: __printf_fp (in /lib/libc-2.5.so)
==4221==    by 0x42D82DB: vfprintf (in /lib/libc-2.5.so)
==4221==    by 0x42E08C2: printf (in /lib/libc-2.5.so)
==4221==    by 0x804FCE1:
MRFEnergy<TypeGeneral>::Minimize_TRW_S(MRFEnergy<TypeGeneral>::Options&,
double&, double&) (minimize.cpp:129)
==4221==    by 0x80491A6: main (testtrw.cpp:88)
==4221==
==4221== Use of uninitialised value of size 4
==4221==    at 0x42D4BD5: (within /lib/libc-2.5.so)
==4221==    by 0x42DBB68: (within /lib/libc-2.5.so)
==4221==    by 0x42DCAD3: __printf_fp (in /lib/libc-2.5.so)
==4221==    by 0x42D82DB: vfprintf (in /lib/libc-2.5.so)
==4221==    by 0x42E08C2: printf (in /lib/libc-2.5.so)
==4221==    by 0x804FCE1:
MRFEnergy<TypeGeneral>::Minimize_TRW_S(MRFEnergy<TypeGeneral>::Options&,
double&, double&) (minimize.cpp:129)
==4221==    by 0x80491A6: main (testtrw.cpp:88)
==4221==
==4221== Use of uninitialised value of size 4
==4221==    at 0x42D4BD8: (within /lib/libc-2.5.so)
==4221==    by 0x42DBB68: (within /lib/libc-2.5.so)
==4221==    by 0x42DCAD3: __printf_fp (in /lib/libc-2.5.so)
==4221==    by 0x42D82DB: vfprintf (in /lib/libc-2.5.so)
==4221==    by 0x42E08C2: printf (in /lib/libc-2.5.so)
==4221==    by 0x804FCE1:
MRFEnergy<TypeGeneral>::Minimize_TRW_S(MRFEnergy<TypeGeneral>::Options&,
double&, double&) (minimize.cpp:129)
==4221==    by 0x80491A6: main (testtrw.cpp:88)
==4221==
==4221== Conditional jump or move depends on uninitialised value(s)
==4221==    at 0x42D4BE2: (within /lib/libc-2.5.so)
==4221==    by 0x42DBB68: (within /lib/libc-2.5.so)
==4221==    by 0x42DCAD3: __printf_fp (in /lib/libc-2.5.so)
==4221==    by 0x42D82DB: vfprintf (in /lib/libc-2.5.so)
==4221==    by 0x42E08C2: printf (in /lib/libc-2.5.so)
==4221==    by 0x804FCE1:
MRFEnergy<TypeGeneral>::Minimize_TRW_S(MRFEnergy<TypeGeneral>::Options&,
double&, double&) (minimize.cpp:129)
==4221==    by 0x80491A6: main (testtrw.cpp:88)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]