Thread overview
[Issue 2176] New: Assertion failure: 'sz == es2->sz' on line 1339 in file 'constfold.c' (concatenating strings of different types)
Jun 26, 2008
d-bugmail
Jun 26, 2008
d-bugmail
Jun 26, 2008
d-bugmail
Sep 03, 2008
d-bugmail
June 26, 2008
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;


-- 

June 26, 2008
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);


-- 

June 26, 2008
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


-- 

September 03, 2008
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


--