Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
July 28, 2010 [Issue 4524] New: Bus error with nested struct | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4524 Summary: Bus error with nested struct Product: D Version: unspecified Platform: Other OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: andrei@metalanguage.com --- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-07-27 21:48:58 PDT --- The code below causes a bus error on OSX: import std.stdio, std.range; void main() { struct BiRange { int[] payload; @property bool empty() { return payload.empty; } @property BiRange save() { return this; } @property ref int front() { return payload[0]; } @property ref int back() { return payload[$ - 1]; } void popFront() { return payload.popFront(); } // void popBack() { return payload.popBack(); } } auto r = BiRange([1, 2, 3, 10, 11, 4]); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 29, 2010 [Issue 4524] Bus error with nested struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=4524 Lars T. Kyllingstad <bugzilla@kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@kyllingen.net OS/Version|Mac OS X |All --- Comment #1 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2010-07-29 13:51:59 PDT --- It causes a segmentation fault on Linux too. Here's a reduced test case without any imports: void g(int j) { } void main() { struct S { int i; void f() { g(i); } } auto s = S(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 20, 2010 [Issue 4524] Bus error with nested struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=4524 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |clugdbug@yahoo.com.au Severity|normal |critical -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 26, 2010 [Issue 4524] Regression(2.026) Bus error with nested struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=4524 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Bus error with nested |Regression(2.026) Bus error |struct |with nested struct Severity|critical |regression --- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-09-26 01:37:01 PDT --- Turns out that this worked on 2.025 and earlier. It also works on D1. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 27, 2010 [Issue 4524] Regression(2.026) Bus error with nested struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=4524 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #3 from Don <clugdbug@yahoo.com.au> 2010-09-27 03:59:07 PDT --- Caused by the fix to bug 2619. When setting the hidden pointer, the wrong offset is used, which overwrites the return stack instead. Yikes. e2ir.c, StructLiteralExp::toElem(), line 4849. Shouldn't be adjusting the 'this' pointer, because setEthis() does already adds ad->vthis->offset to it. All tests in the test suite have v->offset == 0, so this wasn't noticed before. ------ if (sd->isnested) { // Initialize the hidden 'this' pointer assert(sd->fields.dim); Dsymbol *s = (Dsymbol *)sd->fields.data[sd->fields.dim - 1]; ThisDeclaration *v = s->isThisDeclaration(); assert(v); elem *e1; if (tybasic(stmp->Stype->Tty) == TYnptr) { e1 = el_var(stmp); e1->EV.sp.Voffset = soffset; } else { e1 = el_ptr(stmp); if (soffset) e1 = el_bin(OPadd, TYnptr, e1, el_long(TYsize_t, soffset)); } - e1 = el_bin(OPadd, TYnptr, e1, el_long(TYsize_t, v->offset)); e1 = setEthis(loc, irs, e1, sd); e = el_combine(e, e1); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 27, 2010 [Issue 4524] Regression(2.026) Bus error with nested struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=4524 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2010-09-27 13:29:54 PDT --- http://www.dsource.org/projects/dmd/changeset/692 -- 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