digitalmars.D.bugs - [Issue 8068] New: Segmentation fault in std.string.format()
- d-bugmail puremagic.com (30/30) May 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8068
- d-bugmail puremagic.com (57/57) May 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8068
http://d.puremagic.com/issues/show_bug.cgi?id=8068
Summary: Segmentation fault in std.string.format()
Product: D
Version: D2
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: druntime
AssignedTo: nobody puremagic.com
ReportedBy: pablofst gmail.com
This segmentation fault happens when format is called with 6 consecutive
numbers followed by an string. It only occurs on 64bit platforms, on 32 it
works as expected.
The minimal example is as follows:
1 import std.string;
2 import std.stdio;
3
4 void main() {
5 string a = format("%d %d %d %d %d %d %s", 1,2,3,4,5,6,"string");
6 writeln(a);
7 }
8
Regards!
Pablo
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8068
Ali Cehreli <acehreli yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |acehreli yahoo.com
With dmd 2.059 64-bit, I get a "segmentation fault" even though none of the
format() calls have 6 items. There are three layers of structs in the following
code: Outer, Inner, InnerMost:
import std.stdio;
import std.string;
struct InnerMost
{
int m0;
int m1;
string toString()
{
return format("%s %s", m0, m1);
}
}
struct Inner
{
string m0;
int m1;
InnerMost m2;
InnerMost m3;
string toString() const
{
return format("%s %s %s %s", m0, m1, m2, m3);
}
}
struct Outer
{
Inner m0;
string toString() const
{
return format("%s", m0);
}
}
void main()
{
auto im0 = InnerMost(0, 0);
auto im1 = InnerMost(1, 1);
auto i = Inner("hello", 42, im0, im1);
auto o = Outer(i);
o.toString();
}
When built with -m32, there is no bug.
Also, when I replace the first two lines of main with the default
initializations:
auto im0 = InnerMost();
auto im1 = InnerMost();
This time I get "null this" similar to bug 6576.
Ali
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 17 2012








d-bugmail puremagic.com