www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8893] New: [ICE][CTFE] (interpret.c, line 3598) with failed array access

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

           Summary: [ICE][CTFE] (interpret.c, line 3598) with failed array
                    access
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



struct Foo {
    char[3] data;
}
int bar(Foo f) {
    return f.data[0];
}
void main() {
    enum f = Foo(['A', 'B']);
    enum int b = bar(f);
}


DMD 2.061alpha:

test.d(8): Error: cannot implicitly convert expression (['A','B']) of type
char[] to char
Assertion failure: '0' on line 3598 in file 'interpret.c'

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE, ice, pull
                 CC|                            |yebblies gmail.com
           Platform|x86                         |All
         AssignedTo|nobody puremagic.com        |clugdbug yahoo.com.au
         OS/Version|Windows                     |All
           Severity|normal                      |major



https://github.com/D-Programming-Language/dmd/pull/1236

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




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

https://github.com/D-Programming-Language/dmd/commit/f8015992623223985419fa1b69b5102feb6d462c
Fix issue 8893 ICE(interpret.c) with invalid struct literal

The implicit conversion can fail.  In this case the struct literal is
invalid (which means it will never reach CTFE).

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


yebblies <yebblies gmail.com> changed:

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



I can't reproduce this on D1.

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




struct Foo {
    char[3] data;
}
int bar(Foo f) {
    return f.data[0];
}
void main() {
    enum f = Foo(['A', 'B']);
    enum int b = bar(f);
}


The error message seems not correct:

test.d(8): Error: cannot implicitly convert expression (['A','B']) of type
char[] to char


Instead of:

test.d(8): Error: cannot implicitly convert expression (['A','B']) of type
char[] to char[3]

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






 The error message seems not correct:
Moved to Issue 8918 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 30 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8893


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
            Version|D2                          |D1 & D2



00:05:27 PDT ---
D1: https://github.com/D-Programming-Language/dmd/pull/1910

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8893




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

https://github.com/D-Programming-Language/dmd/commit/ee45003465de6eef3165a7d94d06b3ac2127960e
Fix issue 8893 ICE(interpret.c) with invalid struct literal

The implicit conversion can fail.  In this case the struct literal is
invalid (which means it will never reach CTFE).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2013