Comment #0 by bearophile_hugs — 2013-05-12T13:11:51Z
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.
Comment #1 by yebblies — 2013-11-21T08:05:44Z
I can't reproduce this.
Comment #2 by bearophile_hugs — 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.
Comment #3 by bugzilla — 2020-09-15T07:30:03Z
It works on Win64 and fails on Win32.
Comment #4 by robert.schadek — 2024-12-13T18:06:51Z