www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8612] New: struct alignment failure for delegate in catch block referring to the catched exception

reply d-bugmail puremagic.com writes:
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



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: -------
Sep 02 2012
next sibling parent d-bugmail puremagic.com writes:
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



---
*** 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: -------
May 06 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8612


Jeremie Pelletier <jeremiep gmail.com> changed:

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



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: -------
Sep 07 2013
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Oct 06 2013