View mode: basic / threaded / horizontal-split · Log in · Help
October 21, 2012
[Issue 8861] New: compiler should inform as "... can't return lvalue " but crush because of Internal error
http://d.puremagic.com/issues/show_bug.cgi?id=8861

          Summary: compiler should inform as "... can't return lvalue "
                   but crush because of Internal error
          Product: D
          Version: D2
         Platform: All
       OS/Version: All
           Status: NEW
         Severity: normal
         Priority: P2
        Component: DMD
       AssignedTo: nobody@puremagic.com
       ReportedBy: hotcocoamix@gmail.com


--- Comment #0 from hotcocoamix@gmail.com 2012-10-21 01:35:20 PDT ---
I think it should be informed as
" width(height) can not return lvalue. "

dmd(2.060) returned 
" Internal error: ../ztc/cgcs.c 343 "

the example is follows:

class C{
   private int[2] mysize; 

   // The wrong spelling of "mysize".
   // but is not error but crash.
   auto ref width(){    return this.size[0];    }
   auto ref height(){    return this.size[1];    }

   // getter and setter 
   @property{
       int[2] size(){    return this.mysize;    }
       int[2] size( in int[2] xy ){
           this.mysize = xy;
           return xy;
       }
   }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
[Issue 8861] ICE: ../ztc/cgcs.c 343
http://d.puremagic.com/issues/show_bug.cgi?id=8861


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

          What    |Removed                     |Added
----------------------------------------------------------------------------
                CC|                            |andrej.mitrovich@gmail.com
           Summary|compiler should inform as   |ICE: ../ztc/cgcs.c 343
                  |"... can't return lvalue "  |
                  |but crush because of        |
                  |Internal error              |
          Severity|normal                      |major


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-21 13:35:15 PDT ---
Interesting, only seems to happen when array is length 2 or less:

OK:

int[3] mysize;
@property auto size() { return mysize; }
int width() { return size[0]; }
void main() { }

FAIL:

int[2] mysize;
@property auto size() { return mysize; }
int width() { return size[0]; }
void main() { }

I've changed the title to make it more searchable for others. High priority
since ICEs are important.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 03, 2013
[Issue 8861] ICE(cgcs.c) 343
http://d.puremagic.com/issues/show_bug.cgi?id=8861



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-02 17:15:30 PST ---
New test-case, the error message seems to suggest it's related (line numbers
are similar):

struct S
{
   ~this() { }
}

mixin template templ()
{
   auto s = S();
}

void main()
{
   mixin templ;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 03, 2013
[Issue 8861] ICE(cgcs.c) 343
http://d.puremagic.com/issues/show_bug.cgi?id=8861



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-02 17:15:52 PST ---
(In reply to comment #2)
> New test-case, the error message seems to suggest it's related (line numbers
> are similar):

And error:
Internal error: ..\ztc\cgcs.c 344

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 02, 2013
[Issue 8861] ICE(cgcs.c) 343
http://d.puremagic.com/issues/show_bug.cgi?id=8861


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2013-10-01 23:41:17 PDT ---
I cannot reproduce this with dmd 2.063 or later.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home