digitalmars.D.bugs - [Issue 10070] New: Unexpected exception-related program crash
- d-bugmail puremagic.com (73/73) May 12 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10070
http://d.puremagic.com/issues/show_bug.cgi?id=10070
Summary: Unexpected exception-related program crash
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: bearophile_hugs eml.cc
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.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 12 2013








d-bugmail puremagic.com