www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12498] New: while(string) causes compiler to crash during CTFE

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

           Summary: while(string) causes compiler to crash during CTFE
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: olav lindekleiv.com


--- Comment #0 from Olav Lindekleiv <olav lindekleiv.com> 2014-03-31 04:48:35
PDT ---
Example: http://dpaste.dzfl.pl/31b055067ef4

This fails because the while is being checked against a string. Replace "enum"
with "string" in main, and it compiles and executes at runtime.

I also posted this to the forums, which contains the link to a longer example
(after Dustmite, but before manual cleanups):
http://forum.dlang.org/thread/jpkvrfzooezplmckofjt forum.dlang.org#post-qxaqnmoifiubktfuyjcw:40forum.dlang.org

It works on LDC 1.076 and DMD 2.x Git (cfb5842b49) (how old is that?),
according to Dpaste, but not on DMD 2.065 (both Dpaste and my Ubuntu 64bit).

- Olav.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 31 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12498


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-03-31
14:17:04 CEST ---
Thanks for the reduced sample, but in the future please paste code samples
inline (dpaste can sometimes go offline):

-----
string a()
{
    string b;
    while (b) { } // ICE
    return "";
}

void main()
{
    enum t = a();
    string x = t;
}
-----

$ dmd test.d
-----
test.d(12):        called from here: a()
test.d(12):        called from here: a()
__error
DMD v2.066 DEBUG
[] error Internal error: e2ir.c 858
-----

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 31 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12498


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2014-04-03 04:27:52 PDT ---
https://github.com/D-Programming-Language/dmd/pull/3422

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 03 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12498



--- Comment #3 from github-bugzilla puremagic.com 2014-04-03 05:47:58 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/fa9efd8a5e9df74209c3957ab2f15c834a8a798c
fix Issue 12498 - ICE: while(string) causes compiler to crash during CTFE

https://github.com/D-Programming-Language/dmd/commit/2c4d8ad711ccb7c94d349830523dd500580b0130
Merge pull request #3422 from 9rnsr/fix12498

Issue 12498 - ICE: while(string) causes compiler to crash during CTFE

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 03 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12498


Kenji Hara <k.hara.pg gmail.com> changed:

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


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 03 2014