This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

g++ optimizer and exceptions ...



Hallo folks!

There seems to be a bug in the optimizer of g++. The combination of -O2 and
-fomit-frame-pointer results in a segmentation violation or in an illegal 
instruction in some cases of exception handling.

This occurrs in egcs-1.1.2, gcc-2.95 and gcc-2.95-2 (and possibly on older 
versions) on architectures Linux and HP-UX. I also tested on Solaris and OSF 
which both worked fine. The attached programs (buf-segv.cc and bug-ill.cc) will 
produce the mentioned errors.

The bug-ill program only produced a SIGILL with egcs-1.1.2 on RH-6.1 and 
segfaulted in all other cases.


regards,
T.Binder


==================== bug-segv.cc ========================
struct AnException
{
	AnException()
	{}
};

struct BClass
{
	BClass()
	{
		throw AnException();
	}
};


int main()
{
	try
	{
		BClass	bc;
	}
	catch(...)
	{
	}
}
========================================================


=================== bug-ill.cc =========================
struct AClass
{
	AClass();
};

struct BClass
{
	BClass();
};


struct AnException
{
	AnException()
	{}
};



int main()
{
	try
	{
		AClass	ac;
		BClass	bc;
	}
	catch(...)
	{
	}
}



BClass::BClass()
{
	throw AnException();
}

AClass::AClass()
{
}
=======================================================
-- 
"Computers are like air conditioners - they stop working properly when you open
 Windows"
                            \\\|///
                          \\  ~ ~  //
                           (  @ @  )
/------------------------oOOo-(_)-oOOo-----------------------------------------\
| Thomas Binder                        |                                       |
| Institute for  Microelectronics      | phone: ++43/1/58801-36036             |
| Technical University Vienna          |                                       |
| Gusshausstrasse  27-29 / E360        | fax  : ++43/1/58801-36099             |
| A-1040  Vienna                       |                                       |
| A U S T R I A                        | email: binder@iue.tuwien.ac.at        |
\---------------------------------Oooo.----------------------------------------/
                        .oooO     (   )
                        (   )      ) /
                         \ (      (_/
                          \_)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]