Thread overview
[Issue 8939] New: ICE on passing by ref statically initialized const/immutable variable
Nov 02, 2012
Denis Shelomovskij
Nov 02, 2012
Denis Shelomovskij
[Issue 8939] ICE(glue.c) on passing by ref statically initialized const/immutable variable
Nov 15, 2012
Kenji Hara
Nov 15, 2012
Walter Bright
November 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8939

           Summary: ICE on passing by ref statically initialized
                    const/immutable variable
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: ice, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: verylonglogin.reg@gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-11-02 17:56:39 MSK ---
---
void f(T)(ref T) { } // same for `auto ref`

const n = 1; // or `immutable`

void main()
{
    f(n); // main.d(8): Error: constant 1 is not an lvalue
    // And ICE: Assertion failure: '0' on line 1224 in file 'glue.c'
}
---

The bad thing is that it breaks `auto ref` too with same (incorrect now) "not an lvalue" error before ICE.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8939



--- Comment #1 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-11-02 18:23:10 MSK ---
May be connected with
Issue 8940 - Able to modify const/immutable with passing to a templated
function by `ref`

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 15, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8939


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-11-14 17:59:05 PST ---
https://github.com/D-Programming-Language/dmd/pull/1288

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 15, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8939



--- Comment #3 from github-bugzilla@puremagic.com 2012-11-14 18:46:11 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7daa39cc3ff563b50004cda86f4cdc1ae76c2888
fix Issue 8939 - ICE(glue.c) on passing by ref statically initialized
const/immutable variable

Don't optimize an argument on ref parameter, even which can interpret at compile time.

https://github.com/D-Programming-Language/dmd/commit/a1e763cda40722305adb924509dd726af99e9e45 Merge pull request #1288 from 9rnsr/fix8939

Issue 8939 - ICE(glue.c) on passing by ref statically initialized
const/immutable variable

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 15, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8939


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: -------
November 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8939



--- Comment #4 from github-bugzilla@puremagic.com 2012-11-17 16:24:06 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/099d4a80f4ff315b94baeb10bb0f63cc65dfc3b7 fix regression which introduced by fixing bug 8939.

Expression::optimize should keep lvalue-ness of ref argument, but its sub-expressions can be optimized aggressively.

https://github.com/D-Programming-Language/dmd/commit/cc3b46ff3b5737e3e35e86b3db7d0b3b744ab7b5 Merge pull request #1293 from 9rnsr/fix8939reg

fix regression which introduced by fixing bug 8939.

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