digitalmars.D.bugs - [Issue 2990] New: TypeInfo.init() returns invalid array
- d-bugmail puremagic.com (27/27) May 16 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2990
- d-bugmail puremagic.com (9/9) Jan 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=2990
- d-bugmail puremagic.com (10/10) Jan 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=2990
- d-bugmail puremagic.com (22/22) Jan 07 2011 http://d.puremagic.com/issues/show_bug.cgi?id=2990
- d-bugmail puremagic.com (17/17) Apr 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=2990
- d-bugmail puremagic.com (12/12) Apr 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=2990
http://d.puremagic.com/issues/show_bug.cgi?id=2990 Summary: TypeInfo.init() returns invalid array Product: D Version: 1.044 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: nfxjfg gmail.com Sometimes, the array TypeInfo.init() returns has a length, but ptr is null. Accessing an element of such an array causes segfaults. This can't be right. TypeInfo.init() should just return an empty array. Example follows. This outputs "ptr=0000 length=4". import std.stdio; struct X { int y; } void main() { TypeInfo ti = typeid(X); writefln("ptr=%s length=%s", ti.init.ptr, ti.init.length); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 16 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2990 nfxjfg gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2990 Brad Roberts <braddr puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |braddr puremagic.com Resolution|WONTFIX | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2990 Steven Schveighoffer <schveiguy yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schveiguy yahoo.com 06:46:51 PST --- This is really a documentation issue. The init() is correct, as I discovered when fixing a recent bug. Essentially, when the ptr is null, but the length is non-zero, the meaning is that the init value for that type is init().length bytes of zero. This cuts down on having to store an array of zeros in the binary. The documentation for init() says: "Return default initializer, null if default initialize to 0" Which seems to indicate init() should return null if default initializer should be zero. But a null array has length == 0. I think the right solution to this is to change the documentation: "Return default initializer. If the type should be initialized to all zeros, an array with a null ptr and a length equal to the type size will be returned" Sound good? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 07 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2990 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 11:31:07 PDT --- This is deliberate, see the typinf.c code: // void[] init; dtsize_t(pdt, sd->structsize); // init.length if (sd->zeroInit) dtsize_t(pdt, 0); // NULL for 0 initialization else dtxoff(pdt, sd->toInitializer(), 0, TYnptr); // init.ptr I'll fix the documentation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2990 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED 11:41:20 PDT --- https://github.com/D-Programming-Language/druntime/commit/a771c11bfe357ac2c6c87e96b39e8986286222f5 https://github.com/D-Programming-Language/phobos/commit/50a73bef9ac0e6f8bbc713c1ded85a8254175feb -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 05 2011