Loop unrolling -> stack corruption

Waldo Bastian bastian at kde.org
Wed May 8 19:35:10 BST 2002


On Wednesday 08 May 2002 09:50 am, Michael Goffioul wrote:
> Michael Goffioul wrote:
> > Something weird seems to happen with kdeprint code. When compiled with
> > the flag -funroll-loops, crashes happen and it's impossible to debug it
> > with gdb as the stack is corrupted ("Cannot access memory..."). Without
> > that compilation flag, everything is OK.
> > This is tested with gcc-2.95.3.
> >
> > Except valgrinding the code, does anybody have any hint?
>
> More info about this. Here's a complete backtrace when compiling only
> kdelibs/kdeprint/ with -funroll-loops (the rest of KDE is compiled
> without -funroll-loops). It's compiled with (Mandrake) gcc-2.96. The
> backtrace is obtained by attaching gdb to a running process.
>
> Michael.

Sounds like some sort of uninitialized variable that leads to stack 
corruption. Changing the compile flags may then change the value of the 
variable (if it's uninitialized it just becomes whatever happened to be 
there) and depending on the value it may or may not cause a problem.

The other option is that loop-unrolling is broken in 2.96, but I think that's 
less likely.

I would start with valgrind to see if it comes up with anything.

Cheers,
Waldo
-- 
bastian at kde.org  |   SuSE Labs KDE Developer  |  bastian at suse.com





More information about the kde-core-devel mailing list