www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7566] New: compiler works incorrectly when debug{} statements are present, ver 2.057

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7566

           Summary: compiler works incorrectly when debug{} statements are
                    present, ver 2.057
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: tbolsh gmail.com



PST ---
$ more d_compiler_bug_around_debug.d 

import std.stdio;

void main(){
bool dummy_flag = false;
    if( dummy_flag )
        debug{ writeln("debug print 1"); }
                writeln( "Some real action ..." );
        debug{ writeln("debug print 2"); }
        else{
        writeln( "Some other action ");
     }
}
$ ./d_compiler_bug_around_debug.d
Some real action ...
debug print 2
$ dmd -v
DMD32 D Compiler v2.057
Copyright (c) 1999-2011 by Digital Mars written by Walter Bright
Documentation: http://www.digitalmars.com/d/2.0/index.html
...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7566




PST ---
If debug statements are removed - compiler behave as expected:

$ more d_compiler_bug_around_debug.d

import std.stdio;

void main(){
bool dummy_flag = false;
    if( dummy_flag )
        writeln("debug print 1"); 
                writeln( "Some real action ..." );
        writeln("debug print 2"); 
        else{
        writeln( "Some other action ");
     }
}
$ ./d_compiler_bug_around_debug.d
./d_compiler_bug_around_debug.d(10): found 'else' instead of statement
./d_compiler_bug_around_debug.d(13): unrecognized declaration
Failed: dmd -debug -v -o- './d_compiler_bug_around_debug.d' -I'.'
./d_compiler_bug_around_debug.d.deps
-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 23 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7566


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |INVALID



12:30:38 PST ---
I'm not sure what you're expecting, but the compiler behaves correctly in your
first example.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7566




PST ---
I am expecting to see somewhat like 

./d_compiler_bug_around_debug.d(10): found 'else' instead of statement
./d_compiler_bug_around_debug.d(13): unrecognized declaration

when compiled with debug key and nothing when compiled without.
I believe my expectations are correct ...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7566


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com




 I am expecting to see somewhat like 
 
 ./d_compiler_bug_around_debug.d(10): found 'else' instead of statement
 ./d_compiler_bug_around_debug.d(13): unrecognized declaration
 
 when compiled with debug key and nothing when compiled without.
 I believe my expectations are correct ...
The following is valid syntax: debug { } else { } Although I don't think I've ever wanted to use an else block on a debug statement. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 23 2012