Thread overview
Getting a compiler with '-inline'. Is this valid?
Mar 11, 2014
Saurabh Das
Mar 11, 2014
Saurabh Das
Mar 11, 2014
John Colvin
Mar 11, 2014
Saurabh Das
March 11, 2014
Hello,

Consider this simple 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'

Using dmd version "DMD64 D Compiler v2.065" on Linux.

Am I doing something wrong, or is this a compiler bug? (Maybe f.byLine cannot be used in this manner?)

Thanks,
Saurabh

PS: How I came across this: I was trying to scan a file but skip the first line, so I wrote:

    auto f = File("test");
    f.byLine.popFront();
    foreach(line; f.byLine)
    {
        writeln(line);
    }

which gave the error.

PPS: This one uses an intermediate variable and succeeds:

void main()
{
    auto f = File("test");
    auto x = f.byLine;
    x.popFront();
}
March 11, 2014
The title should have read "Getting a compiler _error_ with '-inline'. Is this valid?"

:((
March 11, 2014
On Tuesday, 11 March 2014 at 08:43:11 UTC, Saurabh Das wrote:
> Hello,
>
> Consider this simple 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'
>
> Using dmd version "DMD64 D Compiler v2.065" on Linux.
>
> Am I doing something wrong, or is this a compiler bug? (Maybe f.byLine cannot be used in this manner?)
>
> Thanks,
> Saurabh
>
> PS: How I came across this: I was trying to scan a file but skip the first line, so I wrote:
>
>     auto f = File("test");
>     f.byLine.popFront();
>     foreach(line; f.byLine)
>     {
>         writeln(line);
>     }
>
> which gave the error.
>
> PPS: This one uses an intermediate variable and succeeds:
>
> void main()
> {
>     auto f = File("test");
>     auto x = f.byLine;
>     x.popFront();
> }

Internal compiler errors are always bugs. Please report it here: https://d.puremagic.com/issues/enter_bug.cgi?product=D
March 11, 2014
On Tuesday, 11 March 2014 at 09:10:56 UTC, John Colvin wrote:
<snip>
>
> Internal compiler errors are always bugs. Please report it here: https://d.puremagic.com/issues/enter_bug.cgi?product=D

Oh okay. Will surely do that.

(Yay my first bug report ever!)

March 11, 2014
On Tue, 11 Mar 2014 05:15:45 -0400, Saurabh Das <saurabh.das@gmail.com> wrote:

> On Tuesday, 11 March 2014 at 09:10:56 UTC, John Colvin wrote:
> <snip>
>>
>> Internal compiler errors are always bugs. Please report it here: https://d.puremagic.com/issues/enter_bug.cgi?product=D
>
> Oh okay. Will surely do that.
>
> (Yay my first bug report ever!)
>

Make sure you add the tag "ice", which indicates it's a compiler crash. These get higher priority.

-Steve