STDCXX-600

View: New views
9 Messages — Rating Filter:   Alert me  

STDCXX-600

by Eric Lemings-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
FYI-type stuff.

I've been at this issue for the past couple hours.  Here's what I've
found so far.

My basic test case looks like this:

#include <exceptions>
#include <stdexcept>
 
int main () {
    try {
        // throw statement (see below)
    } catch (std::exception&) {
    } catch (...) {
    }

    return 0;
}

The following "throw statements" all throw exceptions that are not
getting caught by the compiler's runtime libraries:

a. _RW::__rw_throw (_RWSTD_ERROR_OUT_OF_RANGE, _RWSTD_FUNC
("main()"), 1, 0);
b.    _RW::__rw_throw_proc (_RWSTD_ERROR_OUT_OF_RANGE, "what");

No clue yet why they are not caught.

The following "throw statement" however is caught properly:

c.    char* what = "what"; throw (_STD::out_of_rang&)_STD::out_of_range
()._C_assign (what, 0);

Both of the first throw statements ultimately call the last throw
statement so my current guess is that the problem has something to do
with the internal what buffer.

Brad.

RE: STDCXX-600

by Eric Lemings-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 

> -----Original Message-----
> From: Eric Lemings [mailto:Eric.Lemings@...]
> Sent: Wednesday, July 23, 2008 4:10 PM
> To: dev@...
> Subject: STDCXX-600
>
>  
...

>
> The following "throw statements" all throw exceptions that are not
> getting caught by the compiler's runtime libraries:
>
> a. _RW::__rw_throw (_RWSTD_ERROR_OUT_OF_RANGE, _RWSTD_FUNC
> ("main()"), 1, 0);
> b.    _RW::__rw_throw_proc (_RWSTD_ERROR_OUT_OF_RANGE, "what");
>
> No clue yet why they are not caught.
>
> The following "throw statement" however is caught properly:
>
> c.    char* what = "what"; throw
> (_STD::out_of_rang&)_STD::out_of_range
> ()._C_assign (what, 0);
>
> Both of the first throw statements ultimately call the last throw
> statement so my current guess is that the problem has something to do
> with the internal what buffer.

Actually, the second/"b" case above  doesn't even use the internal what
buffer.  So it's not that.

So I'm thinking it may be a compiler bug: throwing an exception from
different namespaces; i.e. in this case, throwing a `std' exception from
a `__rw' function.  I built and ran the test case with a more recent
version of gcc (4.3) and it works fine.

Brad.

Re: STDCXX-600

by Martin Sebor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Lemings wrote:

>  
> FYI-type stuff.
>
> I've been at this issue for the past couple hours.  Here's what I've
> found so far.
>
> My basic test case looks like this:
>
> #include <exceptions>
> #include <stdexcept>
>  
> int main () {
>     try {
>         // throw statement (see below)
>     } catch (std::exception&) {
>     } catch (...) {
>     }
>
>     return 0;
> }
>
> The following "throw statements" all throw exceptions that are not
> getting caught by the compiler's runtime libraries:
>
> a. _RW::__rw_throw (_RWSTD_ERROR_OUT_OF_RANGE, _RWSTD_FUNC
> ("main()"), 1, 0);
> b.    _RW::__rw_throw_proc (_RWSTD_ERROR_OUT_OF_RANGE, "what");
>
> No clue yet why they are not caught.
>
> The following "throw statement" however is caught properly:
>
> c.    char* what = "what"; throw (_STD::out_of_rang&)_STD::out_of_range
> ()._C_assign (what, 0);

Have you tried changing this to something like:

     _STD::out_of_range ex;
     ex._C_assign (what, 0);
     throw ex;

Martin

>
> Both of the first throw statements ultimately call the last throw
> statement so my current guess is that the problem has something to do
> with the internal what buffer.
>
> Brad.


RE: STDCXX-600

by Eric Lemings-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 

> -----Original Message-----
> From: Martin Sebor [mailto:msebor@...] On Behalf Of Martin Sebor
> Sent: Wednesday, July 23, 2008 5:47 PM
> To: dev@...
> Subject: Re: STDCXX-600
>
> Eric Lemings wrote:
> >  
> > FYI-type stuff.
> >
> > I've been at this issue for the past couple hours.  Here's what I've
> > found so far.
> >
> > My basic test case looks like this:
> >
> > #include <exceptions>
> > #include <stdexcept>
> >  
> > int main () {
> >     try {
> >         // throw statement (see below)
> >     } catch (std::exception&) {
> >     } catch (...) {
> >     }
> >
> >     return 0;
> > }
> >
> > The following "throw statements" all throw exceptions that are not
> > getting caught by the compiler's runtime libraries:
> >
> > a. _RW::__rw_throw (_RWSTD_ERROR_OUT_OF_RANGE, _RWSTD_FUNC
> > ("main()"), 1, 0);
> > b.    _RW::__rw_throw_proc (_RWSTD_ERROR_OUT_OF_RANGE, "what");
> >
> > No clue yet why they are not caught.
> >
> > The following "throw statement" however is caught properly:
> >
> > c.    char* what = "what"; throw
> (_STD::out_of_rang&)_STD::out_of_range
> > ()._C_assign (what, 0);
>
> Have you tried changing this to something like:
>
>      _STD::out_of_range ex;
>      ex._C_assign (what, 0);
>      throw ex;

I did but I got some sort of weird compile error: invalid goto label or
something like that.

Brad.

Re: STDCXX-600

by Martin Sebor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Lemings wrote:

>  
>
>> -----Original Message-----
>> From: Martin Sebor [mailto:msebor@...] On Behalf Of Martin Sebor
>> Sent: Wednesday, July 23, 2008 5:47 PM
>> To: dev@...
>> Subject: Re: STDCXX-600
>>
>> Eric Lemings wrote:
>>>  
>>> FYI-type stuff.
>>>
>>> I've been at this issue for the past couple hours.  Here's what I've
>>> found so far.
>>>
>>> My basic test case looks like this:
>>>
>>> #include <exceptions>
>>> #include <stdexcept>
>>>  
>>> int main () {
>>>     try {
>>>         // throw statement (see below)
>>>     } catch (std::exception&) {
>>>     } catch (...) {
>>>     }
>>>
>>>     return 0;
>>> }
>>>
>>> The following "throw statements" all throw exceptions that are not
>>> getting caught by the compiler's runtime libraries:
>>>
>>> a. _RW::__rw_throw (_RWSTD_ERROR_OUT_OF_RANGE, _RWSTD_FUNC
>>> ("main()"), 1, 0);
>>> b.    _RW::__rw_throw_proc (_RWSTD_ERROR_OUT_OF_RANGE, "what");
>>>
>>> No clue yet why they are not caught.
>>>
>>> The following "throw statement" however is caught properly:
>>>
>>> c.    char* what = "what"; throw
>> (_STD::out_of_rang&)_STD::out_of_range
>>> ()._C_assign (what, 0);
>> Have you tried changing this to something like:
>>
>>      _STD::out_of_range ex;
>>      ex._C_assign (what, 0);
>>      throw ex;
>
> I did but I got some sort of weird compile error: invalid goto label or
> something like that.

That's most likely because you forgot to establish a scope
for the block of code containing the declaration of x (it's
illegal to jump past a declaration).

>
> Brad.


RE: STDCXX-600

by Eric Lemings-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 

> -----Original Message-----
> From: Martin Sebor [mailto:sebor@...]
> Sent: Thursday, July 24, 2008 9:55 AM
> To: dev@...
> Subject: Re: STDCXX-600
>
> Eric Lemings wrote:
> >  
> >
> >> -----Original Message-----
> >> From: Martin Sebor [mailto:msebor@...] On Behalf Of
> Martin Sebor
> >> Sent: Wednesday, July 23, 2008 5:47 PM
> >> To: dev@...
> >> Subject: Re: STDCXX-600
> >>
> >> Eric Lemings wrote:
> >>>  
> >>> FYI-type stuff.
> >>>
> >>> I've been at this issue for the past couple hours.  
> Here's what I've
> >>> found so far.
> >>>
> >>> My basic test case looks like this:
> >>>
> >>> #include <exceptions>
> >>> #include <stdexcept>
> >>>  
> >>> int main () {
> >>>     try {
> >>>         // throw statement (see below)
> >>>     } catch (std::exception&) {
> >>>     } catch (...) {
> >>>     }
> >>>
> >>>     return 0;
> >>> }
> >>>
> >>> The following "throw statements" all throw exceptions that are not
> >>> getting caught by the compiler's runtime libraries:
> >>>
> >>> a. _RW::__rw_throw (_RWSTD_ERROR_OUT_OF_RANGE, _RWSTD_FUNC
> >>> ("main()"), 1, 0);
> >>> b.    _RW::__rw_throw_proc (_RWSTD_ERROR_OUT_OF_RANGE, "what");
> >>>
> >>> No clue yet why they are not caught.
> >>>
> >>> The following "throw statement" however is caught properly:
> >>>
> >>> c.    char* what = "what"; throw
> >> (_STD::out_of_rang&)_STD::out_of_range
> >>> ()._C_assign (what, 0);
> >> Have you tried changing this to something like:
> >>
> >>      _STD::out_of_range ex;
> >>      ex._C_assign (what, 0);
> >>      throw ex;
> >
> > I did but I got some sort of weird compile error: invalid
> goto label or
> > something like that.
>
> That's most likely because you forgot to establish a scope
> for the block of code containing the declaration of x (it's
> illegal to jump past a declaration).

I tried that too.  :)

Brad.

RE: STDCXX-600

by Eric Lemings-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 

> -----Original Message-----
> From: Eric Lemings
> Sent: Thursday, July 24, 2008 10:57 AM
> To: 'dev@...'
> Subject: RE: STDCXX-600
>
>  
...

> > >> Have you tried changing this to something like:
> > >>
> > >>      _STD::out_of_range ex;
> > >>      ex._C_assign (what, 0);
> > >>      throw ex;
> > >
> > > I did but I got some sort of weird compile error: invalid
> > goto label or
> > > something like that.
> >
> > That's most likely because you forgot to establish a scope
> > for the block of code containing the declaration of x (it's
> > illegal to jump past a declaration).
>
> I tried that too.  :)

Well I could have sworn I tried that.  The following change works:

Index: src/exception.cpp
===================================================================
--- src/exception.cpp   (revision 679465)
+++ src/exception.cpp   (working copy)
@@ -691,7 +691,11 @@
         throw (_STD::length_error&)_STD::length_error ()._C_assign
(what, 0);

     case _RWSTD_ERROR_OUT_OF_RANGE:
-        throw (_STD::out_of_range&)_STD::out_of_range ()._C_assign
(what, 0);
+    {
+        _STD::out_of_range exc;
+        exc._C_assign (what, 0);
+        throw exc;
+    }

     case _RWSTD_ERROR_RUNTIME_ERROR:
         throw (_STD::runtime_error&)

Should I just check in this change for this particular exception for
now?  I suspect all other standard exceptions would also need to be
changed.

Brad.

RE: STDCXX-600

by Eric Lemings-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 

> -----Original Message-----
> From: Eric Lemings
> Sent: Thursday, July 24, 2008 11:10 AM
> To: Eric Lemings; 'dev@...'
> Subject: RE: STDCXX-600
>
>  
>
...
>
> Should I just check in this change for this particular
> exception for now?  I suspect all other standard exceptions
> would also need to be changed.

Doh.  Scratch that.  I was using the working test case.  The original
test case still fails.

Brad.

Re: STDCXX-600

by Martin Sebor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Lemings wrote:

>  
>
>> -----Original Message-----
>> From: Eric Lemings
>> Sent: Thursday, July 24, 2008 10:57 AM
>> To: 'dev@...'
>> Subject: RE: STDCXX-600
>>
>>  
> ...
>>>>> Have you tried changing this to something like:
>>>>>
>>>>>      _STD::out_of_range ex;
>>>>>      ex._C_assign (what, 0);
>>>>>      throw ex;
>>>> I did but I got some sort of weird compile error: invalid
>>> goto label or
>>>> something like that.
>>> That's most likely because you forgot to establish a scope
>>> for the block of code containing the declaration of x (it's
>>> illegal to jump past a declaration).
>> I tried that too.  :)
>
> Well I could have sworn I tried that.  The following change works:
>
> Index: src/exception.cpp
> ===================================================================
> --- src/exception.cpp   (revision 679465)
> +++ src/exception.cpp   (working copy)
> @@ -691,7 +691,11 @@
>          throw (_STD::length_error&)_STD::length_error ()._C_assign
> (what, 0);
>
>      case _RWSTD_ERROR_OUT_OF_RANGE:
> -        throw (_STD::out_of_range&)_STD::out_of_range ()._C_assign
> (what, 0);
> +    {
> +        _STD::out_of_range exc;
> +        exc._C_assign (what, 0);
> +        throw exc;
> +    }
>
>      case _RWSTD_ERROR_RUNTIME_ERROR:
>          throw (_STD::runtime_error&)
>
> Should I just check in this change for this particular exception for
> now?  I suspect all other standard exceptions would also need to be
> changed.

Right. We might as well do them all.

Martin

>
> Brad.

LightInTheBox - Buy quality products at wholesale price