Bug in egcs 1.1 -fno-rtti + exception = segfault
Martin von Loewis
martin@mira.isdn.cs.tu-berlin.de
Sat Oct 31 10:13:00 GMT 1998
> >> typeid (* (int*) 0);
[...]
> ... which is ok, since dereferencing a NULL pointer leads to undefined
> behavior.
Not in this case. [expr.typeid] says:
>> If the lvalue expression is obtained by applying the unary *
>> operator to a pointer 62) and the pointer is a null pointer value
>> (4.10), the typeid expression throws the bad_typeid exception
>> (18.5.3).
BTW, where does it actually say that dereferencing a null pointer is
undefined behaviour?
Curious,
Martin
More information about the Gcc-bugs
mailing list