www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4578] New: Regression: ICE: Internal error: ../ztc/cg87.c 1364: var+arr[]

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

           Summary: Regression: ICE: Internal error: ../ztc/cg87.c 1364:
                    var+arr[]
           Product: D
           Version: D1
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: baseball.mjp gmail.com


--- Comment #0 from Michael P <baseball.mjp gmail.com> 2010-08-03 15:52:45 PDT
---
Code to create ICE:

void main()
{
    int[] foo;
    int y = 2;
    int[] c = y + foo[];
}

$ dmd test.d
Internal error: ../ztc/cgcod.c 1596

The same error occurs if using the operators +, -, or %.

The proper error is given with operators * and /. (Proper error I think is what
is being given in 1.061)

In 1.061, I would receive this error:

test.d(5): Error: Array operation y + foo[] not implemented

This seems to be because functions AddExp::toElem, MinExp::toElem and
ModExp::toElem in e2ir.c do not have the code that checks for a non-valid
array. The code from these was taken out in 1.062.

The code seemed to be added for MulExp and DivExp because of this issue:

http://d.puremagic.com/issues/show_bug.cgi?id=3522

but was later taken out of AddExp and MinExp.

Perhaps this code in BinExp::toElem:

if ((tb1->ty == Tarray || tb1->ty == Tsarray) &&

    (tb2->ty == Tarray || tb2->ty == Tsarray) &&

     op != OPeq

     )

Should be:

if ((tb1->ty == Tarray || tb1->ty == Tsarray) ||
    (tb2->ty == Tarray || tb2->ty == Tsarray) &&

     op != OPeq

     )

That might catch array ops errors for all of the xxxExp types.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug yahoo.com.au
            Version|D1                          |D1 & D2
            Summary|Regression: ICE: Internal   |Regression(2.047,1.062):
                   |error: ../ztc/cg87.c 1364:  |ICE(cgcod.c): var+arr[]
                   |var+arr[]                   |
         OS/Version|Linux                       |All


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-08-04 00:13:42 PDT ---
That suggested patch is almost right. It fails even for the test case, though!
It needs to allow void assignments. This patch below passes the test suite.

PATCH: e2ir.c, BinExp::toElemBin(), line 2004.

    if ((tb1->ty == Tarray || tb1->ty == Tsarray || 
         tb2->ty == Tarray || tb2->ty == Tsarray) &&
        tb2->ty != Tvoid &&
        op != OPeq && op != OPandand && op != OPoror
       )
    {
        error("Array operation %s not implemented", toChars());
        return el_long(type->totym(), 0);  // error recovery
    }

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2010-08-05
11:16:41 PDT ---
http://www.dsource.org/projects/dmd/changeset/600

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