www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4938] New: dmd segfault when compiling

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

           Summary: dmd segfault when compiling
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: cruxic gmail.com


--- Comment #0 from AdamB <cruxic gmail.com> 2010-09-25 08:42:15 PDT ---
Created an attachment (id=775)
extract this and run compile.sh to cause the segfault

The dmd compiler segfaults when compiling the attached code.  Extract the
archive and run compile.sh.  dmd v2.048 on Ubuntu 10.04 32bit.

Please overlook my messy and error riddled D code as I'm actually in the
process of converting a Vala program to D.

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


bearophile_hugs eml.cc changed:

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


--- Comment #1 from bearophile_hugs eml.cc 2010-09-25 10:33:24 PDT ---
I suggest you to slowly reduce the code, until it's just few lines of code.

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



--- Comment #2 from AdamB <cruxic gmail.com> 2010-09-26 21:03:32 PDT ---
Okay.  I can reduce it if you need me to.  Or does D have a debugging tool
where you can simply run the program under the debugger and it will show you
where the segfault came from?

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code, patch
                 CC|                            |clugdbug yahoo.com.au
            Summary|dmd segfault when compiling |Regression(2.047) dmd
                   |                            |segfault when compiling
           Severity|normal                      |regression


--- Comment #3 from Don <clugdbug yahoo.com.au> 2010-09-27 00:41:56 PDT ---
It's OK, I'm able to reproduce it.

TEST CASE
---------
void bug4938()
{
    try
    {
        return 0;
    }
    catch (Undefined4938 ee)
    {
        return 3;
    }
}
-----------

PATCH
statement.c, line 4132.
-----------
int TryCatchStatement::blockExit()
{
    assert(body);
    int result = body->blockExit();

    int catchresult = 0;
    for (size_t i = 0; i < catches->dim; i++)
    {
        Catch *c = (Catch *)catches->data[i];
+        if (c->type == Type::terror)
+            continue;
        catchresult |= c->blockExit();

        /* If we're catching Object, then there is no throwing
         */
+       assert(c->type->toBasetype()->isClassHandle());
        Identifier *id = c->type->toBasetype()->isClassHandle()->ident;

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2010-09-27
14:17:36 PDT ---
http://www.dsource.org/projects/dmd/changeset/693

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