www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Release build headache: -inline

reply Tom <tom nospam.com> writes:
I have some kind of a middle-size project written in D2. I've been 
compiling always with -debug -unittest switches and, despite having to 
workaround two or three bugs since the beginning, I could always build 
everything. Now I'm ready to give release build a try, so I go with -O 
-release -noboundscheck -inline and get:

E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): expression 
expected, not 'EOF'
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when exp ecting ']'
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ')' following template argument list
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ']'
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ')' following template argument list
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ']'
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ')' following template argument list
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ']'
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ')' following template argument list
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ']'
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' 
when expecting ')' following template argument list
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): no 
identifier for declarator 
Identity!(field[Identity!(field[Identity!(field[Identity!(field[Identity!(field[0])])])])])
E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): semicolon 
expected, not 'EOF'

If I remove -inline, it compiles, but I need performance and to track 
this DMD bug at this point is too damn hard. Any suggestions? :'(

Sometimes I have sinful thoughts and I regret having done this in D... 
But now is too late.

Thanks in advance,
Tom;
Mar 05 2011
next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday 05 March 2011 15:37:15 Tom wrote:
 I have some kind of a middle-size project written in D2. I've been
 compiling always with -debug -unittest switches and, despite having to
 workaround two or three bugs since the beginning, I could always build
 everything. Now I'm ready to give release build a try, so I go with -O
 -release -noboundscheck -inline and get:
 
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): expression
 expected, not 'EOF'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when exp ecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): no
 identifier for declarator
 Identity!(field[Identity!(field[Identity!(field[Identity!(field[Identity!(f
 ield[0])])])])])
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): semicolon
 expected, not 'EOF'
 
 If I remove -inline, it compiles, but I need performance and to track
 this DMD bug at this point is too damn hard. Any suggestions? :'(

Hmm. It looks like it's probably failing due to a bad string mixin related to a tuple - though the fact that it only happens with -inline would make it so that it's a dmd bug of some kind (regardless of how good of bad the string mixin is). It's mixing in an alias for each of the types in the tuple, and somehow, it ends up with mismatched brackets. To really debug this, it's probably going to require know _exactly_ what the tuple is that's failing. It looks like it's a tuple which holds several levels of tuples for its first type/field - something like 4 or 5 of them. Maybe it's blowing up on some kind of recursive template instantiation or something. So, if you can, _please_ find which tuple is dying. Splitting up the build so that you only build one file at a time should make it so that you can find the offending file, which should make it much easier to find the offending line.
 Sometimes I have sinful thoughts and I regret having done this in D...
 But now is too late.

The reality of the matter is that as fantastic as D2 is, it is still in development, and you run into bugs from time to time. Usually, they're not too bad, but sometimes they can be pretty nasty. Fortunately, things have been steadily improving. Unfortunately, bugs need to be _found_ before they can be fixed, and using D for real projects helps us find bugs and make it so that you _won't_ have problems with D in real projects. I suppose that it's a bit like KDE 4.0's situation. They felt that they had to release it or the developers wouldn't port their applications to it, and it wouldn't be ready in any kind of reasonable time frame, but releasing it in the state that it was meant that they were releasing a version which really wasn't ready for general use yet. However, as applications were ported to it and brave/foolish people used it, it improved. And now, the current KDE 4 is quite solid. So, I feel for you, but at the same time, we _need_ people to be developing in D and running into the bugs in dmd, druntime, and Phobos if it's going to become fully fit for general development. - Jonathn M Davis
Mar 05 2011
parent reply Tom <tom nospam.com> writes:
El 05/03/2011 20:56, Jonathan M Davis escribió:
 On Saturday 05 March 2011 15:37:15 Tom wrote:
 I have some kind of a middle-size project written in D2. I've been
 compiling always with -debug -unittest switches and, despite having to
 workaround two or three bugs since the beginning, I could always build
 everything. Now I'm ready to give release build a try, so I go with -O
 -release -noboundscheck -inline and get:

 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): expression
 expected, not 'EOF'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when exp ecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ']'
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF'
 when expecting ')' following template argument list
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): no
 identifier for declarator
 Identity!(field[Identity!(field[Identity!(field[Identity!(field[Identity!(f
 ield[0])])])])])
 E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): semicolon
 expected, not 'EOF'

 If I remove -inline, it compiles, but I need performance and to track
 this DMD bug at this point is too damn hard. Any suggestions? :'(

Hmm. It looks like it's probably failing due to a bad string mixin related to a tuple - though the fact that it only happens with -inline would make it so that it's a dmd bug of some kind (regardless of how good of bad the string mixin is). It's mixing in an alias for each of the types in the tuple, and somehow, it ends up with mismatched brackets. To really debug this, it's probably going to require know _exactly_ what the tuple is that's failing. It looks like it's a tuple which holds several levels of tuples for its first type/field - something like 4 or 5 of them. Maybe it's blowing up on some kind of recursive template instantiation or something. So, if you can, _please_ find which tuple is dying. Splitting up the build so that you only build one file at a time should make it so that you can find the offending file, which should make it much easier to find the offending line.
 Sometimes I have sinful thoughts and I regret having done this in D...
 But now is too late.

The reality of the matter is that as fantastic as D2 is, it is still in development, and you run into bugs from time to time. Usually, they're not too bad, but sometimes they can be pretty nasty. Fortunately, things have been steadily improving. Unfortunately, bugs need to be _found_ before they can be fixed, and using D for real projects helps us find bugs and make it so that you _won't_ have problems with D in real projects. I suppose that it's a bit like KDE 4.0's situation. They felt that they had to release it or the developers wouldn't port their applications to it, and it wouldn't be ready in any kind of reasonable time frame, but releasing it in the state that it was meant that they were releasing a version which really wasn't ready for general use yet. However, as applications were ported to it and brave/foolish people used it, it improved. And now, the current KDE 4 is quite solid. So, I feel for you, but at the same time, we _need_ people to be developing in D and running into the bugs in dmd, druntime, and Phobos if it's going to become fully fit for general development. - Jonathn M Davis

Well, I did what you suggested with success (thanks). Minimal test case: import std.stdio; import std.conv; int main(string[] args) { int[string] t; writeln(text(t)); return 0; } Tried: dmd -O -release -inline -noboundscheck -c -Isrc src\main.d -> ERROR dmd -release -inline -noboundscheck -c -Isrc src\main.d -> ERROR dmd -O -inline -noboundscheck -c -Isrc src\main.d -> OK dmd -O -release -noboundscheck -c -Isrc src\main.d -> OK dmd -O -release -inline -c -Isrc src\main.d -> OK Where ERROR is: E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): expression expected, not 'EOF' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ']' E:\d\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(364): found 'EOF' when expecting ')' following template argument list
Mar 05 2011
parent Tom <tom nospam.com> writes:
El 05/03/2011 22:05, Jonathan M Davis escribió:
 On Saturday 05 March 2011 16:40:02 Tom wrote:
 Well, I did what you suggested with success (thanks).

Okay. I created a bug report for it: http://d.puremagic.com/issues/show_bug.cgi?id=5708 In the meantime, I would suggest that you simply not compile with - noboundscheck. It's likely that it rarely does anything for you anyway. It disables array bounds checking in safe code, and precious little in Phobos is marked as safe at this point, so unless you're marking _your_ code with safe, most of it is likely system (since that's the default), and so the - noboundscheck doesn't actually do anything for you. Array bounds checking is already removed for system and trusted functions with -release. - Jonathan M Davis

Very well. Thanks. Tom;
Mar 05 2011
prev sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday 05 March 2011 16:40:02 Tom wrote:
 Well, I did what you suggested with success (thanks).

Okay. I created a bug report for it: http://d.puremagic.com/issues/show_bug.cgi?id=5708 In the meantime, I would suggest that you simply not compile with - noboundscheck. It's likely that it rarely does anything for you anyway. It disables array bounds checking in safe code, and precious little in Phobos is marked as safe at this point, so unless you're marking _your_ code with safe, most of it is likely system (since that's the default), and so the - noboundscheck doesn't actually do anything for you. Array bounds checking is already removed for system and trusted functions with -release. - Jonathan M Davis
Mar 05 2011