[C++-SIG] CXX problems on SGI

Geoffrey Furnish furnish at actel.com
Mon Sep 11 23:15:36 CEST 2000


Marc Poinot writes:
 > 
 > I have some compile-time concern with CXX 5.0b
 > It looks like it is a compiler bug, I wonder
 > if anybody else has this problem.
 > What kind of compilers are you using ?
 > 
 > Here's what I get into cxx_extensions.cxx :
 > 
 > All lines with extern "C" and a try/catch block
 > into are rejected (compiler makes a core).
 > I had to remove the try/catch blocks.

zork[26] cat extern_try.cc
extern "C" int f()
{
    try {
        int x = 2;
        return x;
    }
    catch(...)
    {
        return -1;
    }
}
zork[27] KCC --strict -c extern_try.cc
zork[28] 

Looks to me like you have a bug in your compiler.  Can you upgrade?
Which version of the SGI compiler are you using?  Latest is
7.3.something. 

I don't think it would be a good idea to remove the try block.
Instead, if there is no way to fix your compiler, I'd suggest moving
the return out of the try/catch block.  The code could set an int
return value code to p->compare(...) in the try block, and to -1 in
the catch block, and then the final statement of the routine, not in
an exception region, could just return this value.

 > extern "C" int compare_handler( PyObject *self, PyObject *other )
 > 	{
 > //	try
 > // 		{
 > 		PythonExtensionBase *p = static_cast<PythonExtensionBase *>( self );
 > 		return p->compare( Py::Object( other ) );
 > //		}
 > //	catch( Py::Exception & )
 > //		{
 > //		return -1;	// indicate error
 > //		}
 > 	}
 > 
 > The SGI known bug is:
 > 
 > 577506 A goto outside a region cannot jump to a label inside a region.
 > 
 > Is there a compiler (SGI ?) expert here ? Looks like the case is we
 > have an exception (jump) from an extern function to a namespace/class
 > scope region ?
 > 
 > Maybe it's possible to reduce the extern part to the simplest one?
 > 
 > -MP-




More information about the Cplusplus-sig mailing list