Jump to page: 1 2
Thread overview
[Issue 13501] Crash with throwing in scope(failure) after throwing in scope(success)
Sep 20, 2014
Vladimir Panteleev
[Issue 13501] [REG2.052] Crash with throwing in scope(failure) after throwing in scope(success)
Sep 21, 2014
Andrew Edwards
Oct 07, 2014
Martin Nowak
Feb 10, 2016
Mathias Lang
Feb 10, 2016
Vladimir Panteleev
Nov 08, 2020
Walter Bright
Nov 08, 2020
Vladimir Panteleev
Nov 08, 2020
Vladimir Panteleev
Dec 06, 2022
RazvanN
Dec 17, 2022
Iain Buclaw
Mar 29, 2023
RazvanN
September 20, 2014
https://issues.dlang.org/show_bug.cgi?id=13501

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |regression

--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> ---
This is an old regression.

Introduced in https://github.com/D-Programming-Language/druntime/commit/c241f8664934ba74b059e0f61e573f3028d53d02

--
September 21, 2014
https://issues.dlang.org/show_bug.cgi?id=13501

Andrew Edwards <edwards.ac@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |edwards.ac@gmail.com
            Summary|Crash with throwing in      |[REG2.052] Crash with
                   |scope(failure) after        |throwing in scope(failure)
                   |throwing in scope(success)  |after throwing in
                   |                            |scope(success)

--
October 07, 2014
https://issues.dlang.org/show_bug.cgi?id=13501

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3
                 CC|                            |code@dawg.eu
           Severity|regression                  |major

--- Comment #2 from Martin Nowak <code@dawg.eu> ---
Any chance that someone can fix this?
I wouldn't rate this as regression because it's extremely old.

--
February 10, 2016
https://issues.dlang.org/show_bug.cgi?id=13501

Mathias Lang <mathias.lang@sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mathias.lang@sociomantic.co
                   |                            |m

--- Comment #3 from Mathias Lang <mathias.lang@sociomantic.com> ---
Is this example valid ? The specs says:

A scope(exit) or scope(success) statement may not exit with a throw, goto,
break, continue, or return; nor may it be entered with a goto.

http://dlang.org/spec/statement.html#ScopeGuardStatement

--
February 10, 2016
https://issues.dlang.org/show_bug.cgi?id=13501

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec

--- Comment #4 from Vladimir Panteleev <thecybershadow@gmail.com> ---
If that's true, then the code inside them must be enforced as @nothrow, but I bet that would break a ton of D code.

It might be that the spec is outdated. Adding spec keyboard.

--
November 08, 2020
https://issues.dlang.org/show_bug.cgi?id=13501

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
Throwing inside the scope statement is what's called a "double fault exception". In C++, doing such aborts the program. Andrei proposed extending D to handle this with "exception chaining" and Don Clugston implemented it.

Unfortunately, exception chaining turns out to be very confusing in its semantics. Worse, it doesn't fit in well with the exception unwinding schemes we'd like D to fit in with.

The spec is correct here, and the compiler should deprecate throwing in the scope statement.

--
November 08, 2020
https://issues.dlang.org/show_bug.cgi?id=13501

--- Comment #6 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
I can understand such limitations being present for scope(exit), but not for
scope(success). scope(success) blocks are trivially lowered by inserting code
before all returns (or other statements that normally leave the scope), so they
should not in principle be special as far as exceptions are concerned.

If the problem is generally about throwing while an exception is in flight, I feel like this is too useful to give up at the point, because error recovery in principle may be a non-trivial operation that itself may throw.

> The spec is correct here, and the compiler should deprecate throwing in the scope statement.

Such a deprecation would need to be about any and all nothrow code, not just throw statements, which would be a major breaking change. It would, at least, break the pattern:

        foreach (foo; foos)
        {
                scope(failure) stderr.writeln("Error while processing foo" ,
foo, ":");
                processFoo(foo);
        }

because the writeln may throw.

--
November 08, 2020
https://issues.dlang.org/show_bug.cgi?id=13501

--- Comment #7 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
(In reply to Vladimir Panteleev from comment #6)
> Such a deprecation would need to be about any and all nothrow code,

non-nothrow code*

--
December 06, 2022
https://issues.dlang.org/show_bug.cgi?id=13501

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #8 from RazvanN <razvan.nitu1305@gmail.com> ---
I cannot reproduce the crash. I'm getting the failure exception being thrown. That's because the scope(failure) simply rewrites to:

int careful()
{
    try
    {
        scope(success) throw new Exception("Success");
        return victim();
    }
    catch(Exception)
    {
        throw new Exception("Failure");
    }
}

Is this on par with your expectations Vladimir?

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=13501

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

--
« First   ‹ Prev
1 2