On 5/29/2011 4:20 AM, Vladimir Panteleev wrote:
Pretty sure it's not the calling convention. aApplycdzd exists only in
the object files for modules which use foreach (dchar c; someString).

I looked into the issue and the problem lines with the use of sprintf in the compiler source. Line 1833 of statement.c.

---
int j = sprintf(fdname, "_aApply%s%.*s%zd", r, 2, fntab[flag], dim);
---

%zd is not supported by MSVCRT sprintf causing _aApplycdzd. What I'm curious about is why this issue only surfaced with 64-bit support.

I've included a patch that solves the issue by enabling MinGW's ANSI printf replacements. I'll apply it to the the repository later.
diff -r 584a5f3a7dce d/Make-lang.in
--- a/d/Make-lang.in    Fri Apr 29 14:13:02 2011 +0100
+++ b/d/Make-lang.in    Wed Jun 01 21:41:06 2011 -0400
@@ -17,6 +17,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+target_os=$(shell echo $(target) | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)/\3/')
 
 # Manual configuration since patching gcc/configure.ac is troublesome...
 
@@ -51,6 +52,11 @@
 # the D language specification.
 #D_EXTRA_DEFINES += -DD_VA_LIST_TYPE_VOIDPTR=1
 
+# Enables support for support C99 printf format specfiers
+ifeq ($(target_os), mingw32)
+D_EXTRA_DEFINES += -D__USE_MINGW_ANSI_STDIO
+endif
+
 # As with C++: (quote) OTOH, I think this means the g++ driver...
 # Note that it would be nice to move the dependency on g++
 # into the C++ rule, but that needs a little bit of work
diff -r 584a5f3a7dce d/dmd/root.c
--- a/d/dmd/root.c      Fri Apr 29 14:13:02 2011 +0100
+++ b/d/dmd/root.c      Wed Jun 01 21:41:06 2011 -0400
@@ -1831,7 +1831,7 @@
 // The compiler shipped with Visual Studio 2005 (and possible
 // other versions) does not support C99 printf format specfiers
 // such as %z and %j
-#if _WIN32 //_MSC_VER
+#if _MSC_VER
 using std::string;
 using std::wstring;
 

Reply via email to