www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6047] New: Segfault when struct with three or more ulongs with a toString is passed to format with at least two substitution clauses.

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

           Summary: Segfault when struct with three or more ulongs with a
                    toString is passed to format with at least two
                    substitution clauses.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: blood.of.life gmail.com



05:01:35 PDT ---
import std.string;

struct A { ulong a, b, c; string toString() { return ""; } }

void main()
{
    A a;
    format("%s%s", a, "");
}



There has to be at least 24 bytes (or so) of declarations, so at least three
ulongs. The toString has to be there. That second parameter to format has to be
there.

Somewhere, there is stack corruption happening. This is preventing SDC's 64 bit
build from working correctly (it crashes when it errors, as the Location struct
is passed to format, manifesting this when its size_t decls are 64 bits wide).

This could be from DMD or Phobos. I'm not sure.

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




05:05:16 PDT ---
I didn't mention my specs. Linux (64 or 32 bit build and output), 2.053 (but
it's been there for months, _at least_, to my knowledge), Phenom II X4, Arch
Linux.

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




(No-repro on Mac OS X.)

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




06:31:32 PDT ---
I was mistaken -- it's only when building a 64 bit binary.

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


Nick Sabalausky <cbkbbejeap mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |critical



20:59:15 PST ---
Raising priority because this is a rather nasty bug to come up against.

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




07:44:59 PST ---
The format string can be blank and this bug will still be triggered. So a
slight reduction is:

import std.string;

struct A { ulong a, b, c; string toString() { return ""; } }

void main()
{
    A a;
    format("", a, "");
}

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




07:59:44 PST ---
Issue 6576 may be related to this.

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




08:46:34 PST ---
I think the root cause of this might be issue 6983.

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


Walter Bright <bugzilla digitalmars.com> changed:

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



01:42:08 PDT ---
I tried this for -m32 and -m64 on Linux, and the program completes without
error on dmd 2.060 latest build.

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