[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
more cygwin problems
From: |
John W. Eaton |
Subject: |
more cygwin problems |
Date: |
Fri, 11 Mar 2005 00:23:05 -0500 |
Can someone who has an up to date Cygwin installation check to see
whether the following program fails? You can compile it with
g++ cygwin-bug.cc
It should print
toit: throwing exception
toit: caught exception
doit: throwing exception
main: caught exception
when you run it. For me, with the latest Cygwin packages and either
gcc 3.3 or 3.4, it fails at the point of throwing the second
exception, so it prints
toit: throwing exception
toit: caught exception
doit: throwing exception
followed by a segfault.
This bug also shows up for me when I compile Octave. In that case, I
see a segfault if I type Ctrl-C at the command prompt.
Thanks,
jwe
#include <setjmp.h>
#include <iostream>
jmp_buf context;
class
exception
{
// empty;
};
static void
toit (void)
{
try
{
std::cerr << "toit: throwing exception" << std::endl;
throw exception ();
}
catch (exception)
{
std::cerr << "toit: caught exception" << std::endl;
longjmp (context, 1);
}
}
static void
doit (void)
{
if (setjmp (context) == 0)
{
toit ();
}
else
{
std::cerr << "doit: throwing exception" << std::endl;
throw exception ();
}
}
int
main (void)
{
try
{
doit ();
}
catch (exception)
{
std::cerr << "main: caught exception" << std::endl;
}
return 0;
}
- more cygwin problems,
John W. Eaton <=