Thread overview
[Issue 7986] New: segfault in rt.lifetime.__doPostblit on array of struct
Apr 26, 2012
Matt Peterson
Apr 26, 2012
Matt Peterson
Apr 26, 2012
Matt Peterson
Apr 27, 2012
Matt Peterson
Apr 27, 2012
dawg@dawgfoto.de
Apr 27, 2012
Matt Peterson
April 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7986

           Summary: segfault in rt.lifetime.__doPostblit on array of
                    struct
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: druntime
        AssignedTo: nobody@puremagic.com
        ReportedBy: ricochet1k@gmail.com


--- Comment #0 from Matt Peterson <ricochet1k@gmail.com> 2012-04-25 21:58:56 PDT ---
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 ()

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7986


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com


--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-04-26 06:41:12 PDT ---
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?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7986


Matt Peterson <ricochet1k@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|All                         |x86_64


--- Comment #2 from Matt Peterson <ricochet1k@gmail.com> 2012-04-26 09:47:31 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7986



--- Comment #3 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-04-26 10:03:28 PDT ---
Can you test with 2.059?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7986



--- Comment #4 from Matt Peterson <ricochet1k@gmail.com> 2012-04-26 10:09:24 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7986


Matt Peterson <ricochet1k@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|druntime                    |DMD


--- Comment #5 from Matt Peterson <ricochet1k@gmail.com> 2012-04-27 01:05:01 PDT ---
(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)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7986


dawg@dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dawg@dawgfoto.de


--- Comment #6 from dawg@dawgfoto.de 2012-04-27 10:10:24 PDT ---
Try to update/rebuild your druntime lib and all linked D objects. The removal of xGetMembers has created a binary incompatibility.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7986


Matt Peterson <ricochet1k@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #7 from Matt Peterson <ricochet1k@gmail.com> 2012-04-27 10:23:52 PDT ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------