[Issue 4089] New: crash when creating JSON output for incomplete struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 14 00:01:07 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4089
Summary: crash when creating JSON output for incomplete struct
Product: D
Version: unspecified
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: ice-on-valid-code, patch
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: r.sagitario at gmx.de
--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2010-04-14 00:01:04 PDT ---
This one-line code:
/// test.d
struct X;
causes a crash when executing
dmd -c -X test.d
Here's a patch
Index: json.c
===================================================================
--- json.c (revision 432)
+++ json.c (working copy)
@@ -307,16 +307,19 @@
}
}
- JsonString(buf, Pmembers);
- buf->writestring(" : [\n");
- size_t offset = buf->offset;
- for (int i = 0; i < members->dim; i++)
- { Dsymbol *s = (Dsymbol *)members->data[i];
- if (offset != buf->offset)
- { buf->writestring(",\n");
- offset = buf->offset;
+ if(members)
+ {
+ JsonString(buf, Pmembers);
+ buf->writestring(" : [\n");
+ size_t offset = buf->offset;
+ for (int i = 0; i < members->dim; i++)
+ { Dsymbol *s = (Dsymbol *)members->data[i];
+ if (offset != buf->offset)
+ { buf->writestring(",\n");
+ offset = buf->offset;
+ }
+ s->toJsonBuffer(buf);
}
- s->toJsonBuffer(buf);
}
JsonRemoveComma(buf);
buf->writestring("]\n");
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list