www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8601] New: CTFE Assertion failure (interpret.c) on dstring[].toUpper

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

           Summary: CTFE Assertion failure (interpret.c) on
                    dstring[].toUpper
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: callumenator gmail.com



import std.string, std.traits, std.conv;

enum E {one, two}
enum dstring[] fields = [EnumMembers!E].to!(dstring[]);
pragma(msg, fields[0].toUpper);

Gives:
Assertion failure: '((ArrayLiteralExp *)se->e1)->ownedByCtfe' on line 7009 in
file 'interpret.c'

DMD32 2.060 Windows 7

Replace dstring[] with string[] and the error changes to a compile-time error
in std.string.toUpper, which also should not occur (far as I can tell).

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE, ice
                 CC|                            |clugdbug yahoo.com.au



Reduced test case:

dchar bug8601(dstring s) {
    dstring w = s[1..$];
    return  w[0];
}

enum dstring e8601 = [cast(dchar)'o', 'n'];
static assert(bug8601(e8601));

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




The dstring ICE is entirely spurious, the assert is wrong and should be
removed.

The situation with string is a completely unrelated bug; it's a
constant-folding issue. A string initialized with an array literal doesn't
support ~= of a 
character of a larger size. Here's a reduced case for that bug.

bool bug8601b()
{
    string r =  ['x', 'q'];
    dchar c = 'ü';
    r ~= c;
    assert(r == "xqü");
    return true;
}

static assert(bug8601b());

bug.d(8): Error: Cannot interpret r ~= c at compile time

This is interesting because an array literal containing multiple code point
characters cannot normally exist.
--------
void main()
{
  string yyy = ['ü', 'q']; // ok
}
string xxx = ['ü', 'q'];  // fails
--------
g.d(8): Error: cannot implicitly convert expression ('\xfc') of type wchar to
immutable(char)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 05 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8601




I split off the unrelated non-ICE bug to a new bug 8659.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8601




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c5e0be499bf9d1ecab59845409e1b8830e7c8376
Fix bug 8601: CTFE ICE on dstring[].toUpper

This error is spurious, the assert is incorrect.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 20 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8601


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
            Version|D2                          |D1 & D2
         Resolution|                            |FIXED


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