Re: RedHat Linux 6.0 warning: stack corruption with "g++ -O2" and"pow()" (fwd)

From: Marc Hemberger (hemberg@clri6a.gsi.de)
Date: Mon Jul 05 1999 - 15:04:18 MEST


---------- Forwarded message ----------
Date: Thu, 1 Jul 1999 10:08:11 +0200 (CED)
From: Marc Hemberger <hemberg@clri6g.gsi.de>
To: "Matthew D. Langston" <langston@SLAC.stanford.edu>
Subject: Re: RedHat Linux 6.0 warning: stack corruption with "g++ -O2" and"pow()"

Dear Matthew,

I repeated your posting on my RH6 machine, and it really crashed with a
core dump.

On a Debian 2.1 machine also with egcs-1.1.2, nothing happened, the
program finished properly without a dump. 

Greetings,

Marc


Below the output from the Debian machine:

hemberg:lxts00/hemberg> g++ -v --save-temps -O2 langston.cxx -o langston
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 Debian GNU/Linux (egcs-1.1.2 release)
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.66/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__
-Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__
-D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix)
-D__EXCEPTIONS -D__OPTIMIZE__ -Asystem(unix) -Acpu(i386) -Amachine(i386)
-Di386 -D__i386 -D__i386__ -Di486 -D__i486 -D__i486__ langston.cxx
langston.ii
GNU CPP version egcs-2.91.66 Debian GNU/Linux (egcs-1.1.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-2
 /usr/local/include
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.66/cc1plus langston.ii -quiet
-dumpbase langston.cc -O2 -version -o langston.s
GNU C++ version egcs-2.91.66 Debian GNU/Linux (egcs-1.1.2 release)
(i486-linux) compiled by GNU C version egcs-2.91.66 Debian GNU/Linux
(egcs-1.1.2 release).
 as -V -Qy -o langston.o langston.s
GNU assembler version 2.9.1 (i486-linux), using BFD version 2.9.1.0.19
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.66/collect2 -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o langston /usr/lib/crt1.o
/usr/lib/crti.o /usr/lib/gcc-lib/i486-linux/egcs-2.91.66/crtbegin.o
-L/usr/lib/gcc-lib/i486-linux/egcs-2.91.66 langston.o -lstdc++ -lm -lgcc
-lc -lgcc /usr/lib/gcc-lib/i486-linux/egcs-2.91.66/crtend.o
/usr/lib/crtn.o

----------------------------------------
Dr. Marc Hemberger

Gesellschaft f. Schwerionenforschung mbH
Planckstr. 1
64291 Darmstadt
Tel.: 06159/71-2554
M.Hemberger@gsi.de

On Wed, 30 Jun 1999, Matthew D. Langston wrote:

> Hi Damir
> 
> Damir Buskulic wrote:
> > 
> > It's very nice you warn us. Could you be more specific, please. I'm
> > using -O2 on LinuxPPC R5 which is the equivalent of RedHat6.0 for
> > Macs.  What is the exact problem, and could you give a simple script
> > that shows it, so I can try and see if it happens also on my mnachine?
> 
> I am cross posting to the roottalk list in case others may want to test
> their systems for this bug as well.
> 
> I have attached the files which I included in my original bug report to
> the egcs developers.
> 
> To test if you might have the bug, then compile "test.cxx" with
> "g++ -O2".  On my system this will create a program that will cause a
> core dump at run time due to a signal 11, Segmentation fault.
> 
> If you inspect the program with gdb (making sure to specify the core
> file), and if you know Intel assembly (see the file test.s for the full,
> but tiny, assembler listing) then it will be obvious where the problem
> is (pow's exponent is being used as a register offset).
> 
> --
> Matthew D. Langston
> SLD, Stanford Linear Accelerator Center
> langston@SLAC.Stanford.EDU
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET