Bug in egcs 1.1 -fno-rtti + exception = segfault

Alexandre Oliva oliva@dcc.unicamp.br
Sat Oct 31 15:24:00 GMT 1998


On Oct 30, 1998, bonnardv@pratique.fr (Valentin Bonnard) wrote:

> AO = Alexandre Oliva <oliva@dcc.unicamp.br>
> JM = Jason Merrill <jason@cygnus.com>
> VB = Valentin Bonnard <bonnardv@pratique.fr> 

>>>>> They don't need each other.  Exceptions need rtti, but the converse
>>>>> does not hold.

VB> Hum. What about:
VB> 
VB> typeid (* (int*) 0);
VB> 
VB> is it undefined behaviour or abort or does it print "Sorry 
VB> exceptions are disabled" ?

JM> It calls __throw_bad_typeid, which throws, and since you didn't compile the
JM> throwing code with EH support, calls terminate and aborts.

AO> ... which is ok, since dereferencing a NULL pointer leads to undefined
AO> behavior.

> No, by the definition of typeid. Not that I consider particulary 
> clean and elegant, but it's standard.

Of course.  Since int is not polymorphic, the type-id expression can
be known at compile time.  It shoudn't throw bad_typeid...  In fact,
I've just tested it, it doesn't throw anything...  egcs is correct.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list