Bug 7845 – ICE(cgcs.c) 354

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2012-04-06T01:26:00Z
Last change time
2012-12-12T03:14:11Z
Keywords
ice
Assigned to
nobody
Creator
maximzms

Comments

Comment #0 by maximzms — 2012-04-06T01:26:26Z
Code: ---------- import std.stdio; void main() { with(File("Vocabulary-4.txt", "rt")) foreach(s; byLine) writeln(s); } ---------- DMD64 D Compiler v2.058 on 64-bit Linux output: ---------- Internal error: ../ztc/cgcs.c 354 ---------- === Additional information === The same error for: ---------- ... auto f = File("Vocabulary-4.txt", "rt"); with(f) foreach(s; byLine) writeln(s); ... ---------- No error for: ---------- ... auto f = File("Vocabulary-4.txt", "rt"); foreach(s; f.byLine) writeln(s); ... ---------- On the following code it works well: ---------- import std.stdio; void main() { struct Foo {string s;} with(Foo("fffuuu")) foreach(c; s) writeln(c); } ----------
Comment #1 by lovelydear — 2012-04-21T10:48:01Z
This works correctly on 2.059 WinXP 32.
Comment #2 by maximzms — 2012-04-22T23:34:47Z
DMD64 D Compiler v2.059 on 64-bit Linux: 1) ==================== import std.stdio; void main() { with(File("Vocabulary-4.txt", "rt")) foreach(s; byLine) writeln(s); } ==================== No compilation errors, no output when run. 2) ==================== import std.stdio; void main() { auto f = File("Vocabulary-4.txt", "rt"); with(f) foreach(s; byLine) writeln(s); } ==================== No compilation errors. Runtime error: ==================== std.exception.ErrnoException@/usr/include/x86_64-linux-gnu/dmd/phobos/std/stdio.d(1223): (Bad file descriptor) ---------------- ./test(void std.stdio.File.LockingTextWriter.put!(char[]).put(char[])+0x7b) [0x42200f] ./test(void std.range.put!(std.stdio.File.LockingTextWriter, char[]).put(ref std.stdio.File.LockingTextWriter, char[])+0x13) [0x421e6b] ./test(void std.stdio.File.write!(char[], char).write(char[], char)+0x63) [0x421e2b] ./test(void std.stdio.File.writeln!(char[]).writeln(char[])+0x48) [0x421d40] ./test(_Dmain+0x7f) [0x4218f7] ./test(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x17) [0x42375f] ./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x4230df] ./test(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x3d) [0x4237ad] ./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x4230df] ./test(main+0xd3) [0x423077] /lib/libc.so.6(__libc_start_main+0xfe) [0x7f132a82fd8e] ---------------- ==================== 3) ==================== import std.stdio; void main() { auto f = File("Vocabulary-4.txt", "rt"); foreach(s; f.byLine) writeln(s); } ==================== Works fine.
Comment #3 by maximzms — 2012-12-12T03:14:11Z
The original issue (internal compiler error) is fixed. All problems concerning "with" statement and "File" structure will go to another issue.