www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Getting a compiler with '-inline'. Is this valid?

reply "Saurabh Das" <saurabh.das gmail.com> writes:
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();
}
Mar 11 2014
next sibling parent "Saurabh Das" <saurabh.das gmail.com> writes:
The title should have read "Getting a compiler _error_ with 
'-inline'. Is this valid?"

:((
Mar 11 2014
prev sibling parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
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
Mar 11 2014
parent reply "Saurabh Das" <saurabh.das gmail.com> writes:
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!)
Mar 11 2014
parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
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
Mar 11 2014