www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8292] New: segfaults on out contract

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

           Summary: segfaults on out contract
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: tobias pankrath.net



PDT ---
dmd segfault.d segfaults, if segfault.d contains

--
module sat;

import std.container;


struct Literal
{
    Var var;
    bool sign;
}

struct Var
{
    size_t idx;
    alias idx this;
}

struct Clause
{
    Literal[] literals;
    alias literals this;
}


struct Watchers
{
    Array!(Array!(Clause*)*) watchlist;
    alias watchlist this;

    Array!(Clause*)* opIndex(Literal lit)
    {
        return watchlist[index(lit)];
    }

    size_t index(Literal lit)
    {
        return lit.var + lit.sign;
    }

    void watch(Literal lit, Clause* cls)
    out
    {
       assert((*this[lit]).length > 0);
    }
    body
    {
    }
} 

void main() {}
--

It does not segfault if the out-contract is not included.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8292




PDT ---
Using arrays instead of Array!T it segfaults if this[lit] is used in watch. If
I write _watchlist[lit] instead it works

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


Walter Bright <bugzilla digitalmars.com> changed:

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



23:23:41 PDT ---
This does not segfault, and runs successfully, on dmd 2.064 head.

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