www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Strange behaviour with -profile

reply "Danny Arends" <Danny.Arends gmail.com> writes:
I have a medium sized project at: 
https://github.com/DannyArends/DaNode

it compiles fine with the normal build switches I used:

    $ rdmd --build-only -O -gc -release -w danode/server.d

if I compile with the -profile switch, I get a weird error:

    $ rdmd --build-only -O -gc -release -profile -w danode/server.d
    "Warning: statement is not reachable"

No line number or anything to point me to a solution

The weird thing is, I'm compiling using also with the -w switch, 
so in theory this should break compilation at the first warning, 
but the executable is created, and runs.

I am using DMD64 D Compiler v2.064, so it could be that the 
newest betas would fix this issue. But I haven gotten around to 
testing those, and this current build 2.064 works fine as a semi 
production build, so updating might also 'degrade' stability, and 
I have to find time to test it.

So I rather fix this, any suggestions ?

Danny Arends
http://www.dannyarends.nl
Feb 23 2014
parent reply "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
On Sunday, 23 February 2014 at 08:32:50 UTC, Danny Arends wrote:
 I have a medium sized project at: 
 https://github.com/DannyArends/DaNode

 it compiles fine with the normal build switches I used:

    $ rdmd --build-only -O -gc -release -w danode/server.d

 if I compile with the -profile switch, I get a weird error:

    $ rdmd --build-only -O -gc -release -profile -w 
 danode/server.d
    "Warning: statement is not reachable"
I thought DMD provided an error if you tried to optimize with debug symbols. -O should not be used with -gc, -g, or -profile Maybe that will address the problem.
Feb 23 2014
parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
On Sunday, 23 February 2014 at 20:46:47 UTC, Jesse Phillips wrote:
 On Sunday, 23 February 2014 at 08:32:50 UTC, Danny Arends wrote:
 I have a medium sized project at: 
 https://github.com/DannyArends/DaNode

 it compiles fine with the normal build switches I used:

   $ rdmd --build-only -O -gc -release -w danode/server.d

 if I compile with the -profile switch, I get a weird error:

   $ rdmd --build-only -O -gc -release -profile -w 
 danode/server.d
   "Warning: statement is not reachable"
I thought DMD provided an error if you tried to optimize with debug symbols. -O should not be used with -gc, -g, or -profile Maybe that will address the problem.
While I think my advice is still correct, I can't seem to find the combination which caused a compiler message: dmd -g -O -profile -release -debug -inline test.d Also found that dub will do the same odd mix of switches: ["profile", "optimize", "inline", "debugInfo"] Debug and optimize just don't make sense together, and profile needs debug symbols I thought.
Feb 24 2014