Bug 7986 – segfault in rt.lifetime.__doPostblit on array of struct

Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2012-04-25T21:58:00Z
Last change time
2012-04-27T10:23:52Z
Assigned to
nobody
Creator
ricochet1k

Comments

Comment #0 by ricochet1k — 2012-04-25T21:58:56Z
Using DMD v2.060 git 900c537038932435eaebdf7c0f80926e0bd8f2f5 postblitbug.d ---- struct X {} void main() { X[] xs; xs ~= [X()]; } ---- gdb backtrace: #0 0x0000000000000001 in ?? () #1 0x000000000041ef10 in rt.lifetime.__doPostblit() (ti=0x630550, len=1, ptr=0x7ffff7ec5fe0) at src/rt/lifetime.d:589 #2 0x00000000004162dc in _d_arrayappendT (ti=0x7ffff7ec5fe0, x=0x429620, y=...) at src/rt/lifetime.d:1611 #3 0x00000000004149fa in D main ()
Comment #1 by schveiguy — 2012-04-26T06:41:12Z
Does not happen on Linux 32-bit DMD 2.059. Looking at the code, it should not be calling postblit (line 589) on this struct, since it doesn't define a specific postblit. The call should have short-circuited before that. I suspect an issue with the TypeInfo generation, or with corruption. I haven't yet duplicated it, so it could be something else altogether. The TypeInfo layout did change recently to accommodate the RTInfo member, could that have something to do with it?
Comment #2 by ricochet1k — 2012-04-26T09:47:31Z
Good to know. I'm on Linux 64-bit. I just tested: the segfault still occurs even with a specific postblit and/or members added to the struct.
Comment #3 by schveiguy — 2012-04-26T10:03:28Z
Can you test with 2.059?
Comment #4 by ricochet1k — 2012-04-26T10:09:24Z
Yes, it works on 2.059, and it worked a few revisions ago. I'll try to do a git bisect later today or tomorrow to find which revision broke it.
Comment #5 by ricochet1k — 2012-04-27T01:05:01Z
(In reply to comment #1) > I suspect an issue with the TypeInfo generation, or with corruption. I haven't > yet duplicated it, so it could be something else altogether. The TypeInfo > layout did change recently to accommodate the RTInfo member, could that have > something to do with it? Exactly right. The bad commit is "add GCInfo" (https://github.com/ricochet1k/dmd/commit/31f974a03de4372a7f95801b3e4f5a09f052ee1e)
Comment #6 by code — 2012-04-27T10:10:24Z
Try to update/rebuild your druntime lib and all linked D objects. The removal of xGetMembers has created a binary incompatibility.
Comment #7 by ricochet1k — 2012-04-27T10:23:52Z
(In reply to comment #6) > Try to update/rebuild your druntime lib and all linked D objects. > The removal of xGetMembers has created a binary incompatibility. Gah, you're right. I assumed that because Phobos automatically builds druntime that it would automatically clean it as well. There are tons of problems with the makefiles that really should be fixed.