Article View: gnu.g++.bug
Article #802Bug on SUN4 with -O option
From: Rech TURLAIS Tel 4216 15-01-92 M...
Date: Fri, 14 Aug 1992 14:30
Date: Fri, 14 Aug 1992 14:30
75 lines
2277 bytes
2277 bytes
The following program has a SEGV when compiled with -O option on SUN4C
( SunOs 4.1.1 ).
The involved part of the code is :
fwd_symb *b = bindings; // bindings is a member of a class and is set to 0
// When -O is on, a SEGV occurs here.
while( b && b->fun == 0 )
b = b->next;
The whole ( but small program ) is below.
Thank you.
P. Turlais
The compile command is :
gcc -v -O tt.cc
Reading specs from /d/turlais/lib/gcc-lib/sun4/2.2.2/specs
gcc version 2.2.2
/d/turlais/lib/gcc-lib/sun4/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -D__OPTIMIZE__ tt.cc /usr/tmp/cca16655.i
GNU CPP version 2.2.2 (sparc)
/d/turlais/lib/gcc-lib/sun4/2.2.2/cc1plus /usr/tmp/cca16655.i -quiet -dumpbase tt.cc -O -version -o /usr/tmp/cca16655.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
as -o tt.o /usr/tmp/cca16655.s
/d/turlais/lib/gcc-lib/sun4/2.2.2/ld -e start -dc -dp /lib/crt0.o -L/d/turlais/lib/gcc-lib/sun4/2.2.2 -L/d/turlais/lib tt.o -lgcc -lc -lgcc
52 halley %
------------- Program -------------------------------------
class symb;
class fwd_symb {
public:
fwd_symb *next;
symb *fun;
int i;
};
class symb {
public:
symb *get_fwd_symb();
char *name;
fwd_symb *bindings;
symb *fun;
int i;
};
symb *symb::get_fwd_symb()
{
fwd_symb *b = bindings;
// When -O is on, a SEGV occurs here.
while( b && b->fun == 0 )
b = b->next;
if( b)
return fun ? fun->get_fwd_symb() : 0;
else
return b->fun ? b->fun->get_fwd_symb() : 0;
}
int main() {
symb es;
es.bindings = 0;
symb *f = es.get_fwd_symb();
}
Technical Details
Message-ID:
<9208141030.AA03717@rechser.total.fr.recherche>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!rechser.total.fr!turlaisShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!rechser.total.fr!turlais From: turlais@rechser.total.fr (Rech TURLAIS Tel 4216 15-01-92 MJ ) Subject: Bug on SUN4 with -O option Message-ID: <9208141030.AA03717@rechser.total.fr.recherche> Sender: gnulists@ai.mit.edu Reply-To: turlais@rechser.total.fr Organization: GNUs Not Usenet Distribution: gnu Date: Fri, 14 Aug 1992 14:30:39 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 76