Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected exception-related program crash #18580

Open
dlangBugzillaToGithub opened this issue May 12, 2013 · 3 comments
Open

Unexpected exception-related program crash #18580

dlangBugzillaToGithub opened this issue May 12, 2013 · 3 comments

Comments

@dlangBugzillaToGithub
Copy link

bearophile_hugs reported this on 2013-05-12T13:11:51Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=10070

CC List

Description

A small Java program found in a blog post:


class Flow {
    static public void main(String[] args) {
        for (int i = 0; i < 6; ++i) {
            System.out.println("Loop: " + i);

            try {
                try {
                    if (i == 3)
                        break;
                } finally {
                    if (i % 2 != 0)
                        throw new Exception("");
                }
            } catch (Exception e) {
                System.out.println("Caught");
            }
        }
    }
}


Its output:

Loop: 0
Loop: 1
Caught
Loop: 2
Loop: 3
Caught
Loop: 4
Loop: 5
Caught


A D translation:

import std.stdio;

void main() {
    foreach (i; 0 .. 6) {
        writeln("Loop: ", i);

        try {
            try {
                if (i == 3)
                    break;
            } finally {
                if (i % 2 != 0)
                    throw new Exception("");
            }
        } catch (Exception e) {
            writeln("Caught");
        }
    }
}


dmd 2.063beta prints:

Loop: 0
Loop: 1
Caught
Loop: 2
Loop: 3

And then it crashes.

Various people in D.learn and on IRC show that maybe this fails only on 32 bit Windows.
@dlangBugzillaToGithub
Copy link
Author

yebblies commented on 2013-11-21T08:05:44Z

I can't reproduce this.

@dlangBugzillaToGithub
Copy link
Author

bearophile_hugs commented on 2013-11-21T09:48:50Z

Reopened because the problem is still present, on Windows Vista 32 bit, dmd 2.065alpha. This issue was discussed on IRC with several persons.

@dlangBugzillaToGithub
Copy link
Author

bugzilla (@WalterBright) commented on 2020-09-15T07:30:03Z

It works on Win64 and fails on Win32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant