Bug 12349 – std.File.flush and error causes segfault after calling close
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-11T22:10:00Z
Last change time
2014-03-12T10:40:33Z
Assigned to
nobody
Creator
ttanjo
Comments
Comment #0 by ttanjo — 2014-03-11T22:10:12Z
In the following code, segfaultFlush and segfaultError cause segfault with DMD v2.066-devel-a707998 in Mac OSX 10.9.2.
=====
import std.stdio;
void segfaultFlush() {
auto f = File("deleteme", "w");
scope(exit) "deleteme".remove;
f.close();
f.flush(); // segfault!
}
void segfaultError() {
auto f = File("deleteme", "w");
scope(exit) "deleteme".remove;
f.close();
assert(f.error); // segfault!
}
void main() {
segfaultFlush();
segfaultError();
}
=====