Bug 12345 – byLine.popFront() fails with 'Internal error: backend/cod2.c 2200' when compiled with '-inline' switch
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-03-11T02:42:20Z
Last change time
2022-06-10T05:29:20Z
Keywords
ice
Assigned to
No Owner
Creator
Saurabh Das
Comments
Comment #0 by saurabh.das — 2014-03-11T02:42:20Z
Consider the file 'byLineError.d':
import std.stdio;
void main()
{
auto f = File("test");
f.byLine.popFront();
}
When I compile:
dmd byLineError.d --- succeeds
dmd -inline byLineError.d --- fails with 'Internal error: backend/cod2.c 2200'
I'm running dmd version "DMD64 D Compiler v2.065" on Linux. I don't have access to Windows/OSX PCs to test it on those OSes.
Note that this variation works:
void main()
{
auto f = File("test");
auto x = f.byLine;
x.popFront();
}
Thanks,
Saurabh
Comment #1 by monarchdodra — 2014-03-11T13:20:14Z
I'm replicating on HEAD, also for linux64.
Comment #2 by monarchdodra — 2014-03-11T13:30:35Z
I'm NOT replicating on win32.
Comment #3 by monarchdodra — 2014-03-11T13:54:54Z
(In reply to comment #2)
> I'm NOT replicating on win32.
My bad, also replicating.
Comment #4 by k.hara.pg — 2014-04-09T08:00:31Z
A shrunken test case that reproduces same internal error in win32.
void main()
{
ByLine!()().popFront();
}
struct ByLine()
{
RefCounted!(ByLineImpl!()) impl;
void popFront()
{
impl._refCounted._store._payload.popFront();
}
}
private struct ByLineImpl()
{
char[] line;
void popFront()
{
if (line.length == 0)
{
line = null;
}
else if (line.length == 0 ? false : line[$-1] == '\n')
{
line = line.ptr[0 .. line.length - 1];
}
}
}
struct RefCounted(T)
{
struct RefCountedStore
{
private struct Impl
{
T _payload;
}
private Impl* _store;
}
RefCountedStore _refCounted;
~this() {}
}