www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 942] New: a delegate defaults to 8 byte alignment when 4 byte is sufficient

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942

           Summary: a delegate defaults to 8 byte alignment when 4 byte is
                    sufficient
           Product: D
           Version: 1.005
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: guido grumpy-cat.com


Delegate variables default to 8 byte alignment.  Delegates consist of two
pointer elements and should use 4 byte alignment instead.

The TypeDelegate struct does not override "unsigned alignsize()" from Type and
defaults to using "d_uns64 size(Loc loc)" to determine the alignment, which is
PTRSIZE * 2.  mtype.c could be updated as follows:

struct TypeDelegate : Type
{
    TypeDelegate(Type *t);
    Type *syntaxCopy();
    Type *semantic(Loc loc, Scope *sc);
    d_uns64 size(Loc loc);
+   unsigned alignsize();
    void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
    Expression *defaultInit();
    int isZeroInit();
    int checkBoolean();
    TypeInfoDeclaration *getTypeInfoDeclaration();
    Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
    int hasPointers();

    type *toCtype();
};

d_uns64 TypeDelegate::size(Loc loc)
{
    return PTRSIZE * 2;
}

+unsigned TypeDelegate::alignsize()
+{
+    // A Delegate consists of two ptr-sized values, so align it on pointer
size
+    // boundary
+    return PTRSIZE;
+}


-- 
Feb 08 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942


bugzilla digitalmars.com changed:

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





Doing this fix would break backwards compatibility, so I don't think this can
be changed at this point.


-- 
Mar 20 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942


guido grumpy-cat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |





Given all of the changes to D in 2.0, including adding new keywords, I don't
believe "breaking backwards compatibility" should be an issue.


-- 
Jul 02 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |WONTFIX



Cases where Walter closes bugs as WONTFIX are so rare, that you have to respect
that.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nfxjfg gmail.com




 Doing this fix would break backwards compatibility, so I don't think this can
 be changed at this point.
What backward compatibility? Show me the D code that can't simply be recompiled using a fixed ABI. Please be reminded that this would create stupid special cases in alternative compiler implementations AND C headers which try to use D types containing delegates. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942




PDT ---
I have long ago abandoned using D.  The fact that it took 3+ years to close
this bug (incorrectly I might add) validates I made the correct choice.  D is
nothing more than a play-thing for Walter, no serious commercial work will ever
be shipped using it.  I submitted many bug reports and patches all of which
were ignored by Walter.  I will spend my time improving viable projects like
LLVM and Google's Go.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



Answer to comment 3: It's true that WONTFIX from Walter are quite uncommon. But
here no enough explanations are given to why this change would break backwards
compatibility. So I think it's positive to have a bit of some more discussion
here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942





 Answer to comment 3: It's true that WONTFIX from Walter are quite uncommon. But
 here no enough explanations are given to why this change would break backwards
 compatibility. So I think it's positive to have a bit of some more discussion
 here.
Yes. But reopening a WONTFIX bug just because you don't like the answer is inappropriate. Frankly, I think it was exceedingly rude. Note that there's nothing still open about this particular bug: Walter said no. The deeper problem is the absence of a roadmap. Better would be to create a bug report about the unambiguous state of the ABI. Note that this is a particularly dangerous breaking of the ABI: it silently changes the generated code without warning. This makes it quite different to things like name mangling changes, which always generate linking errors. Nonetheless, the presence of bugs like bug 3398, which was only recently fixed, does mean it's rather naive to think that the ABI is completely stable at present. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942




Don:

 But reopening a WONTFIX bug just because you don't like the answer is
inappropriate. Frankly, I think it was exceedingly rude. I have just added a comment. I have not reopened it. I think that adding a comment doesn't reopen the bug, so someone else has done it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=942





 Note that there's nothing still open about this particular bug: Walter said no.
Walter is wrong and the argument of binary compatibility is ridiculous. Little issues like these should be resolved as quickly as possible because they are here. There are many more issues similar to this bug report, and unlike this bug, cause actual problems in practice. But Walter doesn't seem to care. Sucks for the user, huh?
 Nonetheless, the presence of bugs like bug 3398, which was only recently fixed,
 does mean it's rather naive to think that the ABI is completely stable at
 present.
There you say it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2010