[Issue 5241] New: dmd: ABI breakage/regression

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 19 08:20:48 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5241

           Summary: dmd: ABI breakage/regression
           Product: D
           Version: D1
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: nfxjfg at gmail.com


--- Comment #0 from nfxjfg at gmail.com 2010-11-19 08:19:30 PST ---
At some point, both dmd and Phobos1 added a new member to TypeInfo_Struct:
m_flags.

The way dmd handles this causes an ABI breakage: dmd will use the _calculated_
size of the struct to calculate the offset of the name string. After that, dmd
_unconditionally_ writes the new m_flags field, and writes it at the same
offset where the name string is supposed to start.

As a result, TypeInfo names for structs are broken. The first 4 items of
typeid(somestruct).toString() will contain garbage. I'm not really sure why
after these 4 bytes, the expected string starts. Either I got it wrong, or the
backend data segment writer does strange things?

The problem doesn't appear if the object.d[i] contains the proper m_align. E.g.
compare:
http://www.dsource.org/projects/phobos/browser/branches/phobos-1.x/phobos/object.d#L141
http://www.dsource.org/projects/tango/browser/trunk/object.di#L163 (WARNING:
BSD LICENSED CODE)

-- 
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