www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9495] New: Win64 vararg issue when first argument is > 8 byte

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

           Summary: Win64 vararg issue when first argument is > 8 byte
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code benjamin-thaut.de


--- Comment #0 from Benjamin Thaut <code benjamin-thaut.de> 2013-02-10 09:10:31
PST ---
The following code will crash on Win64 dmd 2.061 and 2.062 beta

import core.vararg;
import std.stdio;

void print(string fmt, ...)
{
  auto arg = va_arg!(const(char)[])(_argptr);
  writefln(fmt ~ arg);
}

void main(string[] args)
{
  print("+++","---");
}


This version will work:
void print(int fmt, ...)
{
  auto arg = va_arg!(const(char)[])(_argptr);
  writefln("%s %s",fmt,arg);
}

void main(string[] args)
{
  print(1,"---");
} 

The only seems to surface when the first argument to a vararg function is
bigger then 8 byte. This is a major blocker for me as it breaks all my string
formatting functions for 64 bit.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 10 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9495



--- Comment #1 from Benjamin Thaut <code benjamin-thaut.de> 2013-02-12 12:34:45
PST ---
https://github.com/D-Programming-Language/dmd/pull/1657

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9495



--- Comment #2 from github-bugzilla puremagic.com 2013-03-02 18:49:19 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/43bcad18862f8698bb2b527f2c23f7ffb6bc98b8
-Added test case for bug 9495
-Using Target::ptrsize instead of hardcoded constant

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 02 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9495


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
            Version|D2                          |D1 & D2
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 02 2013