[2.92.21] Errors in generated C++ exception code

Bob Glickstein bobg@emphatic.com
Wed Nov 18 23:51:00 GMT 1998


My platform: egcs 19981109 snapshot (version 2.92.21), Linux 2.0.33,
i686.

There is an apparent bug in the 19981109 egcs snapshot (going back at
least a couple months' worth of versions) in C++ exception-handling
code.  The easiest way to reproduce the bug is to download Latte 1.1
from < http://www.latte.org/ >, unpack it, run `configure', and then run
`make check'.  During `make check', latte-html should build correctly,
but the test named `undefined-x' will fail.  That test succeeds with
older versions of gcc.

The failure of the test will produce a core dump.  However, once you
have built the latte-html binary, there is a much shorter route to
generating the same core dump.  Simply issue this command in the
shell:

  echo '\\x' | latte-html -nf

In this example, latte-html is being asked to interpret the Latte
program consisting of the single variable reference `\x'.  It should
fail gracefully with an "undefined variable" error; instead it dumps
core during exception handling.

I can't be sure, but the problem appears to be related to the fact
that in the Latte code, an exception is thrown, then caught, and then
a new exception is thrown from the handler.  The initial throw is in
env.cxx, line 37, in Latte_BindingEnv::lookup().  The catch and
rethrow are at varref.cxx:43, in Latte_VarRef::lookup().

I've tried stepping through the exception-handling code in gdb, but
the stack gets trashed pretty quickly somewhere deep inside
unbreakable code.

Please let me know if there's any way I can help solve this bug.

Cheers.



More information about the Gcc-bugs mailing list