This is the mail archive of the gcc-prs@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]

c++/384: Re: g++ optimizer and exceptions ...



>Number:         384
>Category:       c++
>Synopsis:       g++ optimizer and exceptions ...
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          analyzed
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 06 00:26:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Binder <binder@iue.tuwien.ac.at>
>Release:        2.95.2
>Organization:
IuE
>Environment:
>Description:
 Original-Message-ID: <394E3A54.EE7E2817@iue.tuwien.ac.at>
 Date: Mon, 19 Jun 2000 17:20:52 +0200
 


 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"

>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:

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