D.gnu - [Issue 1543] New: Error boxing floats
- d-bugmail puremagic.com (24/24) Oct 01 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1543
- d-bugmail puremagic.com (27/27) Oct 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1543
- d-bugmail puremagic.com (19/19) Oct 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1543
- d-bugmail puremagic.com (14/14) Oct 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1543
- d-bugmail puremagic.com (5/5) Oct 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1543
- d-bugmail puremagic.com (11/11) Oct 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1543
- d-bugmail puremagic.com (4/4) Oct 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1543
http://d.puremagic.com/issues/show_bug.cgi?id=1543 Summary: Error boxing floats Product: DGCC aka GDC Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: glue layer AssignedTo: dvdfrdmn users.sf.net ReportedBy: mariusmuja gmail.com The following program outputs 0 instead of the correct value (95): import std.stdio; import std.boxer; void main(char[][] args) { float a = 95.0f; Box b = box(a); writefln(b); } I have tested it with the latest svn version of gdc and it doesn't work rorrectly. It outputs the correct value when compiled with dmd. --
Oct 01 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1543 mariusmuja gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mariusmuja gmail.com, | |alan akbkhome.com Summary|Error boxing floats |Incorrect passing of floats | |to variadic functions The error seems to be from the fact that gdc doesn't pass correctly float arguments to variadic functions. In the following example the function foo_d() prints the expected value, but the function foo() doesn't. import std.stdio; void foo(...) { writefln(*cast(float*)_argptr); } void foo_d( ...) { writefln(*cast(double*)_argptr); } void main() { foo(10.1f); foo_d(10.1); } --
Oct 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1543 Seems to be working here, if you avoid the unportable casts... import std.stdio; import std.stdarg; void foo(...) { writefln(va_arg!(float)(_argptr)); } void foo_d( ...) { writefln(va_arg!(double)(_argptr)); } void main() { foo(10.1f); foo_d(10.1); } --
Oct 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1543 mariusmuja gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Component|glue layer |Phobos Summary|Incorrect passing of floats |std.boxer broken for gdc |to variadic functions |(was: Incorrect passing of | |floats to variadic | |functions) I didn't know about va_arg!()(). It seems then that std.boxer is broken for gdc, since it uses the unportable casts and assumes _argptr is of type void*, which by looking at std.stdarg it not necessarily true. --
Oct 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1543 I think that's a known issue, since std.boxer says: "This module make not work on all GCC targets due to assumptions about the type of va_list." --
Oct 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1543 dvdfrdmn users.sf.net changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed this particular problem on targets for which std.boxer already works. Also fixed for 1- and 2-bit integral types. Fix is in SVN rev 183 / release 0.25. --
Oct 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1543 sigh... make that svn rev 184 --
Oct 13 2007