Thread overview
[Issue 8612] New: struct alignment failure for delegate in catch block referring to the catched exception
Sep 02, 2012
Fawzi Mohamed
May 06, 2013
Maxim Fomin
[Issue 8612] ICE(struct.c) struct alignment failure for delegate in catch block referring to the catched exception
Sep 07, 2013
Jeremie Pelletier
Oct 07, 2013
Walter Bright
September 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8612

           Summary: struct alignment failure for delegate in catch block
                    referring to the catched exception
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: fawzi@gmx.ch


--- Comment #0 from Fawzi Mohamed <fawzi@gmx.ch> 2012-09-02 14:55:45 PDT ---
Dmd 2.060

dmd: struct.c:227: static void AggregateDeclaration::alignmember(structalign_t,
unsigned int, unsigned int*): Assertion `alignment > 0 && !(alignment &
(alignment - 1))' failed.

compiling

---------------
module t;
//    extern(C) int printf(const(char)*,...);

int main(char[][] argv){
    try {
    } catch(Exception e){
    auto dl=delegate void(){
        auto myE=e;
        //printf("%*s\n",e.toString()); // if one wants to guarantee
non-outoptimization;
    };
    }
    return 0;
}

---------------

this is is a issue when porting my code from D1 to D2.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 06, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8612


Maxim Fomin <maxim@maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg@gmail.com


--- Comment #1 from Maxim Fomin <maxim@maxim-fomin.ru> 2013-05-06 11:41:38 PDT ---
*** Issue 8710 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8612


Jeremie Pelletier <jeremiep@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jeremiep@gmail.com


--- Comment #2 from Jeremie Pelletier <jeremiep@gmail.com> 2013-09-07 14:39:24 PDT ---
A quick workaround is to call a function from the catch block which handles the delegate:

void main() {
    try throw new Exception("catch me");
    catch(Exception e) {
         doSomething(e);
         auto dg = { throw e; } // this delegate will crash dmd
    }
}

void doSomething(Exception e) {
     auto dg = { throw e; }; // this delegate won't crash dmd
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8612


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |WORKSFORME


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2013-10-06 23:35:23 PDT ---
This compiles without error on 2.064.

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