www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2463] New: No line number in "statement is not reachable" warning

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

           Summary: No line number in "statement is not reachable" warning
           Product: D
           Version: 1.036
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: vlasov scatt.com


dmd test.d -w
warning - Error: statement is not reachable

=== test.d ===
void foo()
{
        assert(0);
        return 0;
}


-- 
Nov 19 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2463


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |diagnostic





Please remember to assign keywords to bug reports.  To everybody reading this:
Please look through issues you've reported and check for missing keywords.

This error is also an instance of issue 952.


-- 
Nov 19 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2463


Witold Baryluk <baryluk smp.if.uj.edu.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |baryluk smp.if.uj.edu.pl



16:27:27 PST ---
It also hapens in more complicated situations. Out of curriosity I added -w to
my project, and found few this "warning - Error: statment is not reachble"
statments, and compilation failed. I have no idea where the problem is exactly,
because this is big projects, with many templates.

What is interesting for some of this warning i have lines numbers like:

warning - corod.d(389): Error: statement is not reachable

but for most:

warning - Error: statement is not reachable

And i can't find good rule when I have line number and when i don't.

Small example:


$ dmd2 -w A.d 
warning - Error: statement is not reachable

=== A.d ====
class A {
    void f() {
        while (true) {}
        return 0;
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 24 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2463




16:27:59 PST ---
I forgot to add in my last Comment, that I'm using DMD 2.032

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 24 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2463


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au
           Severity|minor                       |normal


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 28 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2463


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch



This is because statement.c, line 3515, at the end of
ReturnStatement::semantic()
sets loc to zero.
//----

    if (exp && tbret->ty == Tvoid && !implicit0)
    {
    /* Replace:
     *    return exp;
     * with:
     *    exp; return;
     */
    Statement *s = new ExpStatement(loc, exp);
    exp = NULL;
    s = s->semantic(sc);
-    loc = 0;
    return new CompoundStatement(loc, s, this);
    }

    return this;
}

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



02:24:31 PST ---
changeset 364

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



22:18:31 PST ---
Fixed dmd 1.057 and 2.041

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2010