www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7234] New: Segmentation fault when using stdio

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

           Summary: Segmentation fault when using stdio
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: robert octarineparrot.com



19:46:11 GMT ---
The following test case is invalid code, but it is reproducible using valid
code (DustMite caused some issues here while narrowing down phobos). It
segfaults with dmd 2.057 on both Ubuntu 32 and OS X 64. I've included a comment
for how to get a valid code test case, it depends on phobos though!
----
template isInputRange(R) {
    enum bool isInputRange = is(typeof({ R r; if (r.empty) {} }));
}

void formattedWrite(Writer, Char, A...)(Writer w, in Char, A args) {
    foreach (i, arg; args)
        i= &formatGeneric!(Writer, typeof(arg), Char);
}

struct FormatSpec(Char) {}

void formatValue(Writer, T, Char)(Writer w, T val, ref FormatSpec!Char f) if
(!isInputRange!T) {
}

private void formatGeneric(Writer, D, Char)(Writer w, const(void)* arg, ref
FormatSpec!Char f) {
    formatValue(w, *cast(D*) arg, f);
}
struct File {
    void writefln(S...)(S args) {
        auto w = LockingTextWriter();
        formattedWrite(w, args);
    }

    struct LockingTextWriter {}
}

File stdout;

// You can replace the above with import std.stdio; and
// give the opDispatch below a valid signature to gain a
// valid code test case, it's rather large though!
struct Contract {
    void opDispatch()(){}
}
Contract*mOptional;
void populate()
{
    stdout.writefln("opt   : %s", mOptional);
}
----

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au



This seems to be the same as bug 7231.
It reduces to:

struct Bug7324 {
  void opDispatch()(){}
}

void func7234()
{
   Bug7234 r;
   if (r.xxx) {};
}

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


Walter Bright <bugzilla digitalmars.com> changed:

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



20:48:41 PST ---

 It reduces to:
That doesn't seg fault, but the original does. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 28 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7234




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9926cfdf09c9ecf28a102183562996dea6217051
fix Issue 7234 - Segmentation fault when using stdio

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


Walter Bright <bugzilla digitalmars.com> changed:

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


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