Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
April 23, 2013 [Issue 9982] New: ICE on CTFE for pointer dereference | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9982 Summary: ICE on CTFE for pointer dereference Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: CTFE, ice Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: monarchdodra@gmail.com --- Comment #0 from monarchdodra@gmail.com 2013-04-23 03:23:13 PDT --- Assertion failure: 'dest->op == TOKstructliteral || dest->op == TOKarrayliteral || dest->op == TOKstring' on line 1604 in file 'ctfeexpr.c' and Error: cannot dereference invalid pointer *chunk //---------------- static struct S { } struct SS { S s2; //[1] this(S s1) { //S s2; //[2] emplace(&s2, s1); } } void emplace(S* chunk, S arg) { emplacePostblitter(*chunk, arg); //[3] *chunk = arg; //[4] } private void emplacePostblitter(ref S chunk, S arg) { chunk = arg; } enum s = S(); enum p = SS(s); //---------------- Getting two different errors: [3] : //Assertion failure: 'dest->op == TOKstructliteral || dest->op == TOKarrayliteral || dest->op == TOKstring' on line 1604 in file 'ctfeexpr.c' If we comment [3], then it is [4] that errors: [4] Error: cannot dereference invalid pointer *chunk Interesting enough, if we move line [1] to line [2], then everything works fine. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 23, 2013 [Issue 9982] ICE on CTFE for pointer dereference | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9982 Igor Stepanov <wazar.leollone@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wazar.leollone@yahoo.com --- Comment #1 from Igor Stepanov <wazar.leollone@yahoo.com> 2013-04-23 07:03:08 PDT --- I've tried to simplify this bug case. My resolution: error in operation of taking address of struct member and dereference it. We must ask Don about this. struct Foo(T) { T a; this(T arg) { T* p = &a; *p = arg; } this(T arg, int) { T* p = &a; setRef(*p, arg); } static void setRef(ref T p, T v) { p = v; } } auto ct1 = Foo!int(99); //compiled, but doesn't set this.a to 99 auto ct2 = Foo!int(99, 0); //compiled, but doesn't set this.a to 99 //try with struct struct Bar { int b; } auto ct1_2 = Foo!Bar(Bar(99)); //Error auto ct2_2 = Foo!Bar(Bar(99), 0); //ICE void main() { assert(ct1.a != 99); assert(ct2.a != 99); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 09, 2013 [Issue 9982] ICE on CTFE for pointer dereference | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9982 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|D2 |D1 & D2 Severity|normal |critical --- Comment #2 from Don <clugdbug@yahoo.com.au> 2013-07-09 02:00:27 PDT --- This is a critical bug. Assignment via a pointer to a struct member does not work! struct Bug9982 { int a; } int test9982() { Bug9982 x; int *q = &x.a; *q = 99; assert(x.a == 99); return 1; } static assert(test9982()); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 9982] ICE on CTFE for pointer dereference | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9982 --- Comment #3 from github-bugzilla@puremagic.com 2013-08-26 23:56:25 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/72b160b53662feeb927175260f9e1b165b86009a Issue 9982 case(b) wrong code for dotvar pointer assign The existing code was complicated and just plain wrong. https://github.com/D-Programming-Language/dmd/commit/16c3d57ee460f368337bbd3f2dea39a1ff6e1903 Fix issue 9982 ICE on CTFE for pointer dereference CTFE assignments can resolve to a StructLiteral inplace assign. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 9982] ICE on CTFE for pointer dereference | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9982 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com Version|D1 & D2 |D1 --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2013-08-26 23:56:53 PDT --- Fixed for D2. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 13, 2013 [Issue 9982] ICE on CTFE for pointer dereference | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9982 --- Comment #5 from github-bugzilla@puremagic.com 2013-09-13 10:45:53 PDT --- Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0e7de354e055464634565f22bc764c9695b0475a Issue 9982 case(b) wrong code for dotvar pointer assign The existing code was complicated and just plain wrong. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 13, 2013 [Issue 9982] ICE on CTFE for pointer dereference | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9982 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Version|D1 |D1 & D2 Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation