public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: Major bug -- Exception handling broken
@ 2000-05-31 15:21 Parker, Ron
  0 siblings, 0 replies; 13+ messages in thread
From: Parker, Ron @ 2000-05-31 15:21 UTC (permalink / raw)
  To: earnie_boyd, cygwin

> > I may be wrong but I believe that Mumit is well-aware that 
> structured
> > exception handling is broken on Windows.
> > 
> 
> Yes and low priority on the TODO list.  If Ron would like to 
> take this on
> himself I'm sure that it would be a welcome fix.

Windows SEH, structured exception handling is definately broken.  I searched
the archives for references to C++ exceptions being broken and did not find
much.

If anyone can direct me to more information, I will see what I can do.  But,
I am not experienced at tearing compilers apart and putting them back
together, now cars are a different matter. :^)

^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <E12xGdc-0002uy-00@mx1.ihug.co.nz>]
* RE: Major bug -- Exception handling broken
@ 2000-05-31 15:26 Parker, Ron
  0 siblings, 0 replies; 13+ messages in thread
From: Parker, Ron @ 2000-05-31 15:26 UTC (permalink / raw)
  To: Ross Smith, cygwin

> Thanks, that seems to work. Are there any gotchas I need to watch out
> for when doing it this way? That is, are there any differences between
> invoking via gcc vs g++ that aren't accounted for by adding -lstdc++
> to the link step?

Not that I am aware of.  The verbose output from gcc and g++ looks identical
other than the -lstdc++ option.

^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: Major bug -- Exception handling broken
@ 2000-05-31 15:06 Parker, Ron
  0 siblings, 0 replies; 13+ messages in thread
From: Parker, Ron @ 2000-05-31 15:06 UTC (permalink / raw)
  To: Ross Smith, cygwin; +Cc: 'khan@NanoTech.Wisc.EDU'

> > Exception handling in g++ is totally broken in the current Cygwin
> > release. Almost any program that uses exceptions crashes:
> > 
> > class Foo {};
> > int main() {
> >   try { throw Foo(); }
> >   catch (const Foo&) { return 0; }
> > }
> > 
> > $ g++ foo.cpp -o foo
> > $ ./foo
> > 0 [main] foo 1007 handle_exceptions: Exception: 
> > STATUS_ACCESS_VIOLATION
> > 5052 [main] foo 1007 stackdump: Dumping stack trace to 
> > foo.exe.stackdump
> 
> I have verified that this is a bug.  Mumit Khan, the cygwin 
> gcc guru, is out
> of the country and should be back mid-June.  In the mean time 
> I will see
> what I can find.
> 
> For the time being you may work around it by replacing g++ in 
> the command
> line with gcc.  That produces a working executable.  My best 
> guess at this
> time is that there is a problem with g++ in the specs file.  
> I will check it
> next.

My hunch about the specs file was wrong.  There are no entries related to
g++.  However I did track this down to a problem with g++ using libm.a.

When I did a:
	gcc -v foo.cpp -o foo

the following was the last line of output:
	/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/collect2.exe -o foo.exe
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-pc-cygwin/lib/crt0.o
-L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2
-L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-pc-cygwin/lib
-L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../.. /tmp/ccT9VBnq.o -lgcc
-lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc

And:
	g++ -v foo.cpp -o foo

yields:
	/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/collect2.exe -o foo.exe
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-pc-cygwin/lib/crt0.o
-L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2
-L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-pc-cygwin/lib
-L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../.. /tmp/ccjfPal7.o -lstdc++
-lm -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc

The only significant differences here are the -lstdc++ and the -lm.  This
led to following tests:

gcc -v foo.cpp -o foo -lstd++	(OKAY)
gcc -v foo.cpp -o foo -lstd++	-lm(BAD)
gcc -v foo.cpp -o foo -lm (BAD)

So the problem seems to be with libm.a.  

I did a little more looking around and discovered that g++ should not be
linking against -lm.  So, I came up with the following patch that at least
make g++ able to compile a working version of the trivial test listed above.
It looks like a previous patch of Mumit's may have gotten dropped.

If you cannot rebuild gcc, I can email a stripped and gzip'd version of the
fixed g++. It is only 29,995 bytes.

Wed May 31 14:52:18 CDT 2000 Ron Parker  (rdparker@butlermfg.com)

	* i386/cygwin.h (MATH_LIBRARY): Make it null.



^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <E12xCry-0002nX-00@mx1.ihug.co.nz>]
* Re: Major bug -- Exception handling broken
@ 2000-05-31 14:01 Earnie Boyd
  0 siblings, 0 replies; 13+ messages in thread
From: Earnie Boyd @ 2000-05-31 14:01 UTC (permalink / raw)
  To: cygwin

--- Chris Faylor <cgf@cygnus.com> wrote:
> On Wed, May 31, 2000 at 01:03:05PM -0500, Parker, Ron wrote:
> >> Exception handling in g++ is totally broken in the current Cygwin
> >> release. Almost any program that uses exceptions crashes:
> >> 
> >> class Foo {};
> >> int main() {
> >>   try { throw Foo(); }
> >>   catch (const Foo&) { return 0; }
> >> }
> >> 
> >> $ g++ foo.cpp -o foo
> >> $ ./foo
> >> 0 [main] foo 1007 handle_exceptions: Exception: 
> >> STATUS_ACCESS_VIOLATION
> >> 5052 [main] foo 1007 stackdump: Dumping stack trace to 
> >> foo.exe.stackdump
> >
> >I have verified that this is a bug.  Mumit Khan, the cygwin gcc guru, is out
> >of the country and should be back mid-June.  In the mean time I will see
> >what I can find.
> >
> >For the time being you may work around it by replacing g++ in the command
> >line with gcc.  That produces a working executable.  My best guess at this
> >time is that there is a problem with g++ in the specs file.  I will check it
> >next.
> 
> I may be wrong but I believe that Mumit is well-aware that structured
> exception handling is broken on Windows.
> 

Yes and low priority on the TODO list.  If Ron would like to take this on
himself I'm sure that it would be a welcome fix.

Regards,

=====
---
   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
            __Cygwin: POSIX on Windows__
Cygwin Newbies: < http://www.freeyellow.com/members5/gw32/index.html >
           __Minimalist GNU for Windows__
  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
    Mingw Home: < http://www.mingw.org/ >

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <200005311805.LAA13613@cygnus.com>]
* RE: Major bug -- Exception handling broken
@ 2000-05-31 11:04 Parker, Ron
  0 siblings, 0 replies; 13+ messages in thread
From: Parker, Ron @ 2000-05-31 11:04 UTC (permalink / raw)
  To: Ross Smith, cygwin

> Exception handling in g++ is totally broken in the current Cygwin
> release. Almost any program that uses exceptions crashes:
> 
> class Foo {};
> int main() {
>   try { throw Foo(); }
>   catch (const Foo&) { return 0; }
> }
> 
> $ g++ foo.cpp -o foo
> $ ./foo
> 0 [main] foo 1007 handle_exceptions: Exception: 
> STATUS_ACCESS_VIOLATION
> 5052 [main] foo 1007 stackdump: Dumping stack trace to 
> foo.exe.stackdump

I have verified that this is a bug.  Mumit Khan, the cygwin gcc guru, is out
of the country and should be back mid-June.  In the mean time I will see
what I can find.

For the time being you may work around it by replacing g++ in the command
line with gcc.  That produces a working executable.  My best guess at this
time is that there is a problem with g++ in the specs file.  I will check it
next.

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Major bug -- Exception handling broken
@ 2000-05-30 16:46 Ross Smith
  0 siblings, 0 replies; 13+ messages in thread
From: Ross Smith @ 2000-05-30 16:46 UTC (permalink / raw)
  To: cygwin

Exception handling in g++ is totally broken in the current Cygwin
release. Almost any program that uses exceptions crashes:

class Foo {};
int main() {
  try { throw Foo(); }
  catch (const Foo&) { return 0; }
}

$ g++ foo.cpp -o foo
$ ./foo
0 [main] foo 1007 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
5052 [main] foo 1007 stackdump: Dumping stack trace to foo.exe.stackdump

System is NT4+sp6a; CPU is PIII/450; Cygwin installation is straight
from the current setup.exe. If you need any more details let me know.

(I reported this last week, but nobody paid any attention.)

-- 
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
   "So that's 2 T-1s and a newsfeed ... would you like clues with that?"
                                                       -- Peter Da Silva



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2000-05-31 16:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-31 15:21 Major bug -- Exception handling broken Parker, Ron
     [not found] <E12xGdc-0002uy-00@mx1.ihug.co.nz>
2000-05-31 15:54 ` Ross Smith
2000-05-31 16:10   ` Larry Hall (RFK Partners, Inc)
2000-05-31 16:14     ` Chris Faylor
  -- strict thread matches above, loose matches on Subject: below --
2000-05-31 15:26 Parker, Ron
2000-05-31 15:06 Parker, Ron
     [not found] <E12xCry-0002nX-00@mx1.ihug.co.nz>
2000-05-31 14:45 ` Ross Smith
2000-05-31 14:01 Earnie Boyd
     [not found] <200005311805.LAA13613@cygnus.com>
2000-05-31 13:15 ` Chris Faylor
2000-05-31 14:47   ` Ross Smith
2000-05-31 15:00     ` Chris Faylor
2000-05-31 11:04 Parker, Ron
2000-05-30 16:46 Ross Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).