www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9309] New: Regression (2.061): -O -release generates wrong code

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

           Summary: Regression (2.061): -O -release generates wrong code
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: coffimplib
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-12
17:29:46 PST ---
Reduced from Issue 9307:

import std.exception;
import std.stdio;

pure nothrow
private string escapeShellArguments()
{
    char[] buf;

     safe nothrow
    char[] allocator(size_t size)
    {
        return buf = new char[size];
    }

    escapeShellArgument!allocator("foo");
    return assumeUnique(buf);
}

 safe nothrow
auto escapeShellArgument(alias allocator)(in char[] arg)
{
    auto buf = allocator(4);
    buf[0] = 'f';
    buf[1] = 'o';
    buf[2] = 'o';
    buf[3] = '\0';
}

void main(string[] args)
{
    string res = escapeShellArguments();
    writeln(res);
}

$ dmd test.d && test.exe
 foo

$ dmd test.d -release -O && test.exe

If you remove the safe nothrow and pure attributes the bug goes away. Cannot reproduce in 2.060, so this is a regression. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9309


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

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


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-12
17:30:20 PST ---
*** Issue 9307 has been marked as a duplicate of this issue. ***

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



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-12
17:43:16 PST ---
I'm bisecting right now.

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



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-12
17:44:56 PST ---
(In reply to comment #2)
 I'm bisecting right now.

Git says: b6a809346a43c7fbf350bd4181d350dd9b2cd4e6 is the first bad commit -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9309



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-12
17:46:19 PST ---
(In reply to comment #3)
 (In reply to comment #2)
 I'm bisecting right now.

Git says: b6a809346a43c7fbf350bd4181d350dd9b2cd4e6 is the first bad commit

See https://github.com/D-Programming-Language/dmd/pull/1110 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9309


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
          Component|coffimplib                  |DMD


--- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2013-01-12 20:30:48 PST ---
https://github.com/D-Programming-Language/dmd/pull/1474

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



--- Comment #6 from github-bugzilla puremagic.com 2013-01-12 23:57:15 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a3373759c41931171a5fd023ab7df8e9f1689879
fix Issue 9309 - Regression (2.061): -O -release generates wrong code

In current, all nested functions should be weak purity at most.

https://github.com/D-Programming-Language/dmd/commit/7686d93349861f83e7c8adc1e0fad0f36f932e64
Merge pull request #1474 from 9rnsr/fix9309

Issue 9309 - Regression (2.061): -O -release generates wrong code

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


Walter Bright <bugzilla digitalmars.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2013