digitalmars.D.bugs - [Issue 7056] New: weird segfault in std.conv.to
- d-bugmail puremagic.com (96/96) Dec 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7056
- d-bugmail puremagic.com (13/13) Aug 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7056
- d-bugmail puremagic.com (10/10) Aug 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7056
- d-bugmail puremagic.com (7/7) Aug 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7056
http://d.puremagic.com/issues/show_bug.cgi?id=7056
Summary: weird segfault in std.conv.to
Product: D
Version: D1 & D2
Platform: All
OS/Version: All
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: mrmocool gmx.de
import std.conv;
import std.math;
void main()
{
import std.stdio;
vec3 w = vec3();
writefln("%f w: %f", 3.5f, w.length);
}
struct Vector(T, int dim)
{
union
{
struct
{
T x = 0;
T y = 0;
T z = 0;
}
T[dim] cell;
}
string toString() {
return to!string(cell);
}
/// return length*length
property T sqLength()
{
return cast()x * x + y * y + z * z;
}
/// return the vector length
property T length() {
toString;
auto ret = sqLength;
return sqrt(ret);
}
}
alias Vector!(float, 3) vec3;
$ dmd -debug -gc vector.d && gdb --batch -ex 'run' -ex 'bt 15' ./vector
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7669faa in snprintf () from /lib/x86_64-linux-gnu/libc.so.6
std.format.formatValue!(std.array.Appender!(immutable(char)[]).Appender, float,
char).formatValue(std.array.Appender!(immutable(char)[]).Appender, float, ref
std.format.FormatSpec!(char).FormatSpec) (f=0x7fffffffdcd8, obj=0, w=...) at
/home/trass3r/coding/dmd/linux/bin64/../../src/phobos/std/format.d:1204
std.format.formatElement!(std.array.Appender!(immutable(char)[]).Appender,
float, char).formatElement(std.array.Appender!(immutable(char)[]).Appender,
float, ref std.format.FormatSpec!(char).FormatSpec) (f=0x7fffffffdcd8, val=0,
w=...) at
/home/trass3r/coding/dmd/linux/bin64/../../src/phobos/std/format.d:1596
std.format.formatRange!(std.array.Appender!(immutable(char)[]).Appender,
float[], char).formatRange(std.array.Appender!(immutable(char)[]).Appender,
float[], ref std.format.FormatSpec!(char).FormatSpec) (f=0x7fffffffdcd8,
val=0x00007fffffffdd780000000000000003, w=...) at
/home/trass3r/coding/dmd/linux/bin64/../../src/phobos/std/format.d:1452
std.format.formatValue!(std.array.Appender!(immutable(char)[]).Appender,
float[], char).formatValue(std.array.Appender!(immutable(char)[]).Appender,
float[], ref std.format.FormatSpec!(char).FormatSpec) (f=0x7fffffffdcd8,
val=0x00007fffffffdd780000000000000003, w=...) at
/home/trass3r/coding/dmd/linux/bin64/../../src/phobos/std/format.d:1386
float[]).toStr(float[]) (src=0x00007fffffffdd780000000000000003) at
/home/trass3r/coding/dmd/linux/bin64/../../src/phobos/std/conv.d:94
float[]).toImpl(float[]) (s=0x00007fffffffdd780000000000000003) at
/home/trass3r/coding/dmd/linux/bin64/../../src/phobos/std/conv.d:803
float[3]).toImpl(ref float[3]) (s=0x7fffffffdd78) at
/home/trass3r/coding/dmd/linux/bin64/../../src/phobos/std/conv.d:353
std.conv.to!(immutable(char)[]).to!(float[3]).to(float[3]) (_param_0=...) at
/home/trass3r/coding/dmd/linux/bin64/../../src/phobos/std/conv.d:237
3).Vector.toString() (this=0x7fffffffde10) at vector.d:25
3).Vector.length() (this=0x7fffffffde10) at vector.d:36
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7056
hsteoh quickfur.ath.cx changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hsteoh quickfur.ath.cx
I can't reproduce this bug in git HEAD
(1a6da16ef112e03607574758b722698f2950b0de) running on Linux/64. Could you check
to see if it still occurs either in the latest release or in git HEAD? Since
it's been a while, the bug may have been fixed already.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7056
Maxim Fomin <maxim maxim-fomin.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |maxim maxim-fomin.ru
Resolution| |WORKSFORME
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 20 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7056 It's probably a good idea to add this code to a unittest in std.conv, to prevent regressions in the future. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 20 2013









d-bugmail puremagic.com 