www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2176] New: Assertion failure: 'sz == es2->sz' on line 1339 in file 'constfold.c' (concatenating strings of different types)

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

           Summary: Assertion failure: 'sz == es2->sz' on line 1339 in file
                    'constfold.c' (concatenating strings of different types)
           Product: D
           Version: 1.031
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jarrett.billingsley gmail.com


OH COME ON.  HONESTLY.

auto s = "foo"d ~ "bar"c;


-- 
Jun 25 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2176


davidl 126.com changed:

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




------- Comment #1 from davidl 126.com  2008-06-26 00:30 -------
constfold.c  :
789 or so
    else if (e1->op == TOKstring && e2->op == TOKstring)
    {   StringExp *es1 = (StringExp *)e1;

+++     if (sz != es2.sz)
+++     {
+++         error("cannot concatnate two different string type");
+++         return e;
+++     }
---      assert(es1->sz == es2->sz);

1339 line or so
        Type *t;
        size_t len = es1->len + es2->len;
        int sz = es1->sz;


+++     if (sz != es2.sz)
+++     {
+++         error("cannot concatnate two different string type");
+++         return e;
+++     }
---      assert(es1->sz == es2->sz);


-- 
Jun 25 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2176





------- Comment #2 from davidl 126.com  2008-06-26 00:35 -------
oh sorry, the patch for line 789 or so should be something
    else if (e1->op == TOKstring && e2->op == TOKstring)
    {   StringExp *es1 = (StringExp *)e1;

+++     if (sz != es2.sz)
+++     {
+++         cmp = 1;
+++     }
---     assert(es1->sz == es2->sz);


and another test case is:
pragma(msg, "foo"d == "bar"c? "A":"B");

this can trigger the Equal assertion failure


-- 
Jun 25 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2176


bugzilla digitalmars.com changed:

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




------- Comment #3 from bugzilla digitalmars.com  2008-09-03 01:35 -------
Fixed dmd 1.035 and 2.019


-- 
Sep 02 2008