RE: Bug in g++: Testcase exits with segmentation fault

2003-01-14 Thread Chris January

 The testcase attached to this mail compiled with g++ 2.95.3-10 or g++ 3.2
 20020927 under Cygwin 1.3.18 exits with segmentation fault. It seems to be
 an error in g++ as the testcase doesn't work under Linux either.
 Can anyone
 help or do I have to report this error to the GCC website?

 BTW I found two ways to make the testcase work:
 1) Change line 64 (and 70 respectively) and use observer
 *Observer instead
 of std::listobserver. I compiled the testcase with STLport-4.5.3 under
 Linux to see if it's a bug in the Standard Library but got again
 segmentation fault.
 2) Remove line 75 which is a simple poll(NULL, 0, 2000). It
 works without
 this line but I don't know why.

The bug is actually in your testcase.
The line:
Observers.push_back(observer());
creates a temporary observer object. So when the line
observer::observer() { Select.give(this); }
calls give(), it leaves a dangling pointer.

Chris


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




RE: Bug in g++: Testcase exits with segmentation fault

2003-01-14 Thread Boris Schaeling


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Chris
 January
 Sent: Tuesday, January 14, 2003 6:01 PM
 To: Boris Schaeling
 Cc: [EMAIL PROTECTED]
 Subject: RE: Bug in g++: Testcase exits with segmentation fault

 [...]
 The bug is actually in your testcase.
 The line:
   Observers.push_back(observer());
 creates a temporary observer object. So when the line
   observer::observer() { Select.give(this); }
 calls give(), it leaves a dangling pointer.

Oh, you are right. I've forgotten to use a smart pointer ... thanks for your
feedback!

Boris


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




RE: Bug in g++: Testcase exits with segmentation fault

2003-01-14 Thread Igor Pechtchanski
On Tue, 14 Jan 2003, Chris January wrote:

  The testcase attached to this mail compiled with g++ 2.95.3-10 or g++ 3.2
  20020927 under Cygwin 1.3.18 exits with segmentation fault. It seems to be
  an error in g++ as the testcase doesn't work under Linux either.
  Can anyone help or do I have to report this error to the GCC website?
 
  BTW I found two ways to make the testcase work:
  1) Change line 64 (and 70 respectively) and use observer
  *Observer instead
  of std::listobserver. I compiled the testcase with STLport-4.5.3 under
  Linux to see if it's a bug in the Standard Library but got again
  segmentation fault.
  2) Remove line 75 which is a simple poll(NULL, 0, 2000). It
  works without
  this line but I don't know why.

 The bug is actually in your testcase.
 The line:
 Observers.push_back(observer());
 creates a temporary observer object. So when the line
 observer::observer() { Select.give(this); }
 calls give(), it leaves a dangling pointer.

 Chris

True, but not the issue here.  Even buggy programs shouldn't *crash* the
compiler.  Just my 2c.
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: Bug in g++: Testcase exits with segmentation fault

2003-01-13 Thread Gareth Pearce
When a program crashes crashes on cygwin - also crashes in the same way on a
platform other then cygwin - its quite obviously not a cygwin problem and
therefore the original author of said software should be contacted.

In this case you do indeed have to report this error to the gcc website.
Given its a g++ bug, theres some likelihood of it having been fixed in gcc
3.4 (experimental) - but it will be a while before you see that distributed
in cygwin (or as part of a stable linux distribution) I expect.

Gareth
- Original Message -
From: Boris Schaeling [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 14, 2003 2:13 AM
Subject: Bug in g++: Testcase exits with segmentation fault


 The testcase attached to this mail compiled with g++ 2.95.3-10 or g++ 3.2
 20020927 under Cygwin 1.3.18 exits with segmentation fault. It seems to be
 an error in g++ as the testcase doesn't work under Linux either. Can
anyone
 help or do I have to report this error to the GCC website?

 BTW I found two ways to make the testcase work:
 1) Change line 64 (and 70 respectively) and use observer *Observer
instead
 of std::listobserver. I compiled the testcase with STLport-4.5.3 under
 Linux to see if it's a bug in the Standard Library but got again
 segmentation fault.
 2) Remove line 75 which is a simple poll(NULL, 0, 2000). It works
without
 this line but I don't know why.

 Boris







 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Bug reporting: http://cygwin.com/bugs.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/