www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6241] New: test sdtor.d on osx not catching

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

           Summary: test sdtor.d on osx not catching
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Mac OS X
            Status: NEW
          Keywords: EH, wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: braddr puremagic.com



---
Extracted and slightly reduced from the larger test file:

import std.c.stdio;
import core.exception;

struct S56
{
    int x = 1;

    this(int i) { printf("ctor %p(%d)\n", &this, i); }
    ~this() { printf("dtor %p\n", &this); }
}

int foo56()
{
    throw new Throwable("hello");
    return 5;
}

void test56()
{
    int i;
    int j;
    try
    {   
        i = S56(1).x + foo56() + 1;
    }
    catch (Throwable o)
    {   
        printf("caught\n");
        j = 1;
    }
    printf("i = %d, j = %d\n", i, j);
    assert(i == 0);
    assert(j == 1);
}

int main()
{
    test56();
    return 0;
}

On linux, caught is printed and the asserts are fine.
On osx, it's not, and they're not.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6241




---
Additionally, without the additional assert(j == 1) in this version of the code
(which should be added to the full sdtor.d file), test56 is implicated in the
current auto-tester failure where with -inline, on osx garbage is printed at
the end of the test run, before the Success line at the bottom main.

My current reduction has it down to just test28 and test56.  The extra garbage
output varied a good bit through the reduction.  Taking out the throw line, the
problem disappears.  Taking out other parts also makes the problem go away, so
it's not firm evidence yet.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6241


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



11:53:42 PDT ---
Ah, I see what the problem is (stack alignment). Will see about fixing it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6241


Brad Roberts <braddr puremagic.com> changed:

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



---
Fixed:
https://github.com/D-Programming-Language/dmd/commit/b38a3700ee83741fa234fd8cbedde86ed0755a1a

Test:
https://github.com/D-Programming-Language/dmd/commit/f37c8a2a18602561fe18c2433175edd5b325f0e1

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