diff -u dmd-0.174/attrib.c dmd-0.174-format_string/attrib.c
--- dmd-0.174/attrib.c	2006-11-13 11:26:14.000000000 +0100
+++ dmd-0.174-format_string/attrib.c	2006-11-15 15:51:06.000000000 +0100
@@ -743,7 +743,7 @@
 		if (e->op == TOKstring)
 		{
 		    StringExp *se = (StringExp *)e;
-		    fprintf(stdmsg, "%.*s", se->len, se->string);
+		    fprintf(stdmsg, "%.*s", (int)se->len, se->string);
 		}
 		else
 		    error("string expected for message, not '%s'", e->toChars());
diff -u dmd-0.174/cast.c dmd-0.174-format_string/cast.c
--- dmd-0.174/cast.c	2006-11-13 15:33:56.000000000 +0100
+++ dmd-0.174-format_string/cast.c	2006-11-15 15:51:06.000000000 +0100
@@ -690,7 +690,7 @@
 	    {
 		p = utf_decodeChar((unsigned char *)se->string, len, &u, &c);
 		if (p)
-		    error(p);
+		    error("%s", p);
 		else
 		    buffer.writeUTF16(c);
 	    }
@@ -703,7 +703,7 @@
 	    {
 		p = utf_decodeChar((unsigned char *)se->string, len, &u, &c);
 		if (p)
-		    error(p);
+		    error("%s", p);
 		buffer.write4(c);
 		newlen++;
 	    }
@@ -715,7 +715,7 @@
 	    {
 		p = utf_decodeWchar((unsigned short *)se->string, len, &u, &c);
 		if (p)
-		    error(p);
+		    error("%s", p);
 		else
 		    buffer.writeUTF8(c);
 	    }
@@ -728,7 +728,7 @@
 	    {
 		p = utf_decodeWchar((unsigned short *)se->string, len, &u, &c);
 		if (p)
-		    error(p);
+		    error("%s", p);
 		buffer.write4(c);
 		newlen++;
 	    }
@@ -972,13 +972,13 @@
 		if (f)
 		{   int offset;
 		    if (f->tintro && f->tintro->next->isBaseOf(f->type->next, &offset) && offset)
-			error(msg);
+			error("%s", msg);
 		    e = new DelegateExp(loc, e1, f);
 		    e->type = t;
 		    return e;
 		}
 		if (func->tintro)
-		    error(msg);
+		    error("%s", msg);
 	    }
 	}
 	e = Expression::castTo(sc, t);
@@ -987,7 +987,7 @@
     {	int offset;
 
 	if (func->tintro && func->tintro->next->isBaseOf(func->type->next, &offset) && offset)
-	    error(msg);
+	    error("%s", msg);
     }
     e->type = t;
     return e;
diff -u dmd-0.174/class.c dmd-0.174-format_string/class.c
--- dmd-0.174/class.c	2006-11-13 11:27:52.000000000 +0100
+++ dmd-0.174-format_string/class.c	2006-11-15 15:51:06.000000000 +0100
@@ -70,43 +70,43 @@
 	{
 	    if (id == Id::TypeInfo)
 	    {	if (Type::typeinfo)
-		    Type::typeinfo->error(msg);
+		    Type::typeinfo->error("%s", msg);
 		Type::typeinfo = this;
 	    }
 
 	    if (id == Id::TypeInfo_Class)
 	    {	if (Type::typeinfoclass)
-		    Type::typeinfoclass->error(msg);
+		    Type::typeinfoclass->error("%s", msg);
 		Type::typeinfoclass = this;
 	    }
 
 	    if (id == Id::TypeInfo_Interface)
 	    {	if (Type::typeinfointerface)
-		    Type::typeinfointerface->error(msg);
+		    Type::typeinfointerface->error("%s", msg);
 		Type::typeinfointerface = this;
 	    }
 
 	    if (id == Id::TypeInfo_Struct)
 	    {	if (Type::typeinfostruct)
-		    Type::typeinfostruct->error(msg);
+		    Type::typeinfostruct->error("%s", msg);
 		Type::typeinfostruct = this;
 	    }
 
 	    if (id == Id::TypeInfo_Typedef)
 	    {	if (Type::typeinfotypedef)
-		    Type::typeinfotypedef->error(msg);
+		    Type::typeinfotypedef->error("%s", msg);
 		Type::typeinfotypedef = this;
 	    }
 
 	    if (id == Id::TypeInfo_Pointer)
 	    {	if (Type::typeinfopointer)
-		    Type::typeinfopointer->error(msg);
+		    Type::typeinfopointer->error("%s", msg);
 		Type::typeinfopointer = this;
 	    }
 
 	    if (id == Id::TypeInfo_Array)
 	    {	if (Type::typeinfoarray)
-		    Type::typeinfoarray->error(msg);
+		    Type::typeinfoarray->error("%s", msg);
 		Type::typeinfoarray = this;
 	    }
 
@@ -118,50 +118,50 @@
 
 	    if (id == Id::TypeInfo_AssociativeArray)
 	    {	if (Type::typeinfoassociativearray)
-		    Type::typeinfoassociativearray->error(msg);
+		    Type::typeinfoassociativearray->error("%s", msg);
 		Type::typeinfoassociativearray = this;
 	    }
 
 	    if (id == Id::TypeInfo_Enum)
 	    {	if (Type::typeinfoenum)
-		    Type::typeinfoenum->error(msg);
+		    Type::typeinfoenum->error("%s", msg);
 		Type::typeinfoenum = this;
 	    }
 
 	    if (id == Id::TypeInfo_Function)
 	    {	if (Type::typeinfofunction)
-		    Type::typeinfofunction->error(msg);
+		    Type::typeinfofunction->error("%s", msg);
 		Type::typeinfofunction = this;
 	    }
 
 	    if (id == Id::TypeInfo_Delegate)
 	    {	if (Type::typeinfodelegate)
-		    Type::typeinfodelegate->error(msg);
+		    Type::typeinfodelegate->error("%s", msg);
 		Type::typeinfodelegate = this;
 	    }
 
 	    if (id == Id::TypeInfo_Tuple)
 	    {	if (Type::typeinfotypelist)
-		    Type::typeinfotypelist->error(msg);
+		    Type::typeinfotypelist->error("%s", msg);
 		Type::typeinfotypelist = this;
 	    }
 	}
 
 	if (id == Id::Object)
 	{   if (object)
-		object->error(msg);
+		object->error("%s", msg);
 	    object = this;
 	}
 
 	if (id == Id::ClassInfo)
 	{   if (classinfo)
-		classinfo->error(msg);
+		classinfo->error("%s", msg);
 	    classinfo = this;
 	}
 
 	if (id == Id::ModuleInfo)
 	{   if (Module::moduleinfo)
-		Module::moduleinfo->error(msg);
+		Module::moduleinfo->error("%s", msg);
 	    Module::moduleinfo = this;
 	}
     }
diff -u dmd-0.174/declaration.c dmd-0.174-format_string/declaration.c
--- dmd-0.174/declaration.c	2006-11-14 01:45:44.000000000 +0100
+++ dmd-0.174-format_string/declaration.c	2006-11-15 15:51:06.000000000 +0100
@@ -638,7 +638,7 @@
 	{   Argument *arg = Argument::getNth(tt->arguments, i);
 
 	    OutBuffer buf;
-	    buf.printf("_%s_field_%d", ident->toChars(), i);
+	    buf.printf("_%s_field_%zu", ident->toChars(), i);
 	    buf.writeByte(0);
 	    char *name = (char *)buf.extractData();
 	    Identifier *id = new Identifier(name, TOKidentifier);
diff -u dmd-0.174/dump.c dmd-0.174-format_string/dump.c
--- dmd-0.174/dump.c	2005-01-15 03:36:10.000000000 +0100
+++ dmd-0.174-format_string/dump.c	2006-11-15 15:51:06.000000000 +0100
@@ -39,7 +39,7 @@
 void IntegerExp::dump(int i)
 {
     indent(i);
-    printf("%p %lld type=%s\n", this, (d_int64)value, type_print(type));
+    printf("%p %jd type=%s\n", this, (intmax_t)value, type_print(type));
 }
 
 void IdentifierExp::dump(int i)
diff -u dmd-0.174/expression.c dmd-0.174-format_string/expression.c
--- dmd-0.174/expression.c	2006-11-14 02:01:08.000000000 +0100
+++ dmd-0.174-format_string/expression.c	2006-11-15 15:51:06.000000000 +0100
@@ -373,7 +373,7 @@
     size_t nparams = Argument::dim(tf->parameters);
 
     if (nargs > nparams && tf->varargs == 0)
-	error(loc, "expected %d arguments, not %d\n", nparams, nargs);
+	error(loc, "expected %zu arguments, not %zu\n", nparams, nargs);
 
     n = (nargs > nparams) ? nargs : nparams;	// n = max(nargs, nparams)
 
@@ -397,7 +397,7 @@
 		{
 		    if (tf->varargs == 2 && i + 1 == nparams)
 			goto L2;
-		    error(loc, "expected %d arguments, not %d\n", nparams, nargs);
+		    error(loc, "expected %zu arguments, not %zu\n", nparams, nargs);
 		    break;
 		}
 		arg = p->defaultArg->copy();
@@ -411,7 +411,7 @@
 		if (arg->implicitConvTo(p->type))
 		{
 		    if (nargs != nparams)
-		        error(loc, "expected %d arguments, not %d\n", nparams, nargs);
+		        error(loc, "expected %zu arguments, not %zu\n", nparams, nargs);
 		    goto L1;
 		}
 	     L2:
@@ -992,7 +992,7 @@
 {
     static char buffer[sizeof(value) * 3 + 1];
 
-    sprintf(buffer, "%lld", value);
+    sprintf(buffer, "%jd", value);
     return buffer;
 }
 
@@ -1149,7 +1149,7 @@
 
 	    case Tint32:
 	    L2:
-		buf->printf("%ld", (int)v);
+		buf->printf("%d", (int)v);
 		break;
 
 	    case Tuns8:
@@ -1162,15 +1162,15 @@
 
 	    case Tuns32:
 	    L3:
-		buf->printf("%ldu", (unsigned)v);
+		buf->printf("%du", (unsigned)v);
 		break;
 
 	    case Tint64:
-		buf->printf("%lldL", v);
+		buf->printf("%jdL", v);
 		break;
 
 	    case Tuns64:
-		buf->printf("%lldLU", v);
+		buf->printf("%juLU", v);
 		break;
 
 	    case Tbit:
@@ -1192,17 +1192,17 @@
 	}
     }
     else if (v & 0x8000000000000000LL)
-	buf->printf("0x%llx", v);
+	buf->printf("0x%jx", v);
     else
-	buf->printf("%lld", v);
+	buf->printf("%jd", v);
 }
 
 void IntegerExp::toMangleBuffer(OutBuffer *buf)
 {
     if ((sinteger_t)value < 0)
-	buf->printf("N%lld", -value);
+	buf->printf("N%jd", -value);
     else
-	buf->printf("%lld", value);
+	buf->printf("%jd", value);
 }
 
 /******************************** RealExp **************************/
@@ -2075,7 +2075,7 @@
 		{
 		    p = utf_decodeChar((unsigned char *)string, len, &u, &c);
 		    if (p)
-		    {	error(p);
+		    {	error("%s", p);
 			break;
 		    }
 		    else
@@ -2096,7 +2096,7 @@
 		{
 		    p = utf_decodeChar((unsigned char *)string, len, &u, &c);
 		    if (p)
-		    {	error(p);
+		    {	error("%s", p);
 			break;
 		    }
 		    else
@@ -2257,7 +2257,7 @@
 	    {
                 p = utf_decodeWchar((unsigned short *)string, len, &u, &c);
                 if (p)
-                    error(p);
+                    error("%s", p);
                 else
                     tmp.writeUTF8(c);
 	    }
@@ -5547,7 +5547,7 @@
 	}
 	else
 	{
-	    error("string slice [%llu .. %llu] is out of bounds", i1, i2);
+	    error("string slice [%ju .. %ju] is out of bounds", i1, i2);
 	    e = e1;
 	}
 	return e;
@@ -5890,7 +5890,7 @@
 	    }
 	    else
 	    {
-		error("array index [%llu] is outside array bounds [0 .. %llu]",
+		error("array index [%jd] is outside array bounds [0 .. %zu]",
 			index, length);
 		e = e1;
 	    }
diff -u dmd-0.174/func.c dmd-0.174-format_string/func.c
--- dmd-0.174/func.c	2006-11-13 17:16:12.000000000 +0100
+++ dmd-0.174-format_string/func.c	2006-11-15 15:51:06.000000000 +0100
@@ -650,7 +650,7 @@
 		{
 		    //error("no identifier for parameter %d of %s", i + 1, toChars());
 		    OutBuffer buf;
-		    buf.printf("_param_%d", i);
+		    buf.printf("_param_%zu", i);
 		    char *name = (char *)buf.extractData();
 		    id = new Identifier(name, TOKidentifier);
 		    arg->ident = id;
diff -u dmd-0.174/init.c dmd-0.174-format_string/init.c
--- dmd-0.174/init.c	2006-10-07 00:46:32.000000000 +0200
+++ dmd-0.174-format_string/init.c	2006-11-15 15:51:06.000000000 +0100
@@ -327,7 +327,7 @@
     }
     unsigned long amax = 0x80000000;
     if ((unsigned long) dim * t->next->size() >= amax)
-	error(loc, "array dimension %u exceeds max of %lu", dim, amax / t->next->size());
+	error(loc, "array dimension %u exceeds max of %ju", dim, amax / t->next->size());
     return this;
 }
 
diff -u dmd-0.174/lexer.c dmd-0.174-format_string/lexer.c
--- dmd-0.174/lexer.c	2006-11-13 15:37:22.000000000 +0100
+++ dmd-0.174-format_string/lexer.c	2006-11-15 15:51:06.000000000 +0100
@@ -116,9 +116,9 @@
     {
 	case TOKint32v:
 #if IN_GCC
-	    sprintf(buffer,"%ld",(d_int32)int64value);
+	    sprintf(buffer,"%d",(d_int32)int64value);
 #else
-	    sprintf(buffer,"%ld",int32value);
+	    sprintf(buffer,"%d",int32value);
 #endif
 	    break;
 
@@ -127,18 +127,18 @@
 	case TOKwcharv:
 	case TOKdcharv:
 #if IN_GCC
-	    sprintf(buffer,"%luU",(d_uns32)uns64value);
+	    sprintf(buffer,"%uU",(d_uns32)uns64value);
 #else
-	    sprintf(buffer,"%luU",uns32value);
+	    sprintf(buffer,"%uU",uns32value);
 #endif
 	    break;
 
 	case TOKint64v:
-	    sprintf(buffer,"%lldL",int64value);
+	    sprintf(buffer,"%jdL", (intmax_t)int64value);
 	    break;
 
 	case TOKuns64v:
-	    sprintf(buffer,"%lluUL",uns64value);
+	    sprintf(buffer,"%juUL", (uintmax_t)uns64value);
 	    break;
 
 #if IN_GCC
@@ -164,7 +164,7 @@
 	    break;
 
 	case TOKfloat80v:
-	    sprintf(buffer,"%gL", float80value);
+	    sprintf(buffer,"%LgL", float80value);
 	    break;
 
 	case TOKimaginary32v:
@@ -176,7 +176,7 @@
 	    break;
 
 	case TOKimaginary80v:
-	    sprintf(buffer,"%gLi", float80value);
+	    sprintf(buffer,"%LgLi", float80value);
 	    break;
 #endif
 
@@ -1203,7 +1203,7 @@
 			case ';':
 			    c = HtmlNamedEntity(idstart, p - idstart);
 			    if (c == ~0)
-			    {   error("unnamed character entity &%.*s;", p - idstart, idstart);
+			    {   error("unnamed character entity &%.*s;", (int)(p - idstart), idstart);
 				c = ' ';
 			    }
 			    p++;
@@ -2306,7 +2306,7 @@
     p += idx - 1;
     if (msg)
     {
-	error(msg);
+	error("%s", msg);
     }
     return u;
 }
diff -u dmd-0.174/mangle.c dmd-0.174-format_string/mangle.c
--- dmd-0.174/mangle.c	2006-11-08 18:55:44.000000000 +0100
+++ dmd-0.174-format_string/mangle.c	2006-11-15 15:51:06.000000000 +0100
@@ -186,7 +186,7 @@
 	//printf("  parent = '%s', kind = '%s'\n", parent->mangle(), parent->kind());
 	buf.writestring(parent->mangle());
     }
-    buf.printf("%d%s", strlen(id), id);
+    buf.printf("%zu%s", strlen(id), id);
     //buf.writestring("_");
     //buf.writestring(id);
     id = buf.toChars();
diff -u dmd-0.174/mtype.c dmd-0.174-format_string/mtype.c
--- dmd-0.174/mtype.c	2006-11-14 01:46:04.000000000 +0100
+++ dmd-0.174-format_string/mtype.c	2006-11-15 15:51:06.000000000 +0100
@@ -1589,7 +1589,7 @@
     return sz;
 
 Loverflow:
-    error(loc, "index %lld overflow for static array", sz);
+    error(loc, "index %jd overflow for static array", sz);
     return 1;
 }
 
@@ -1660,7 +1660,7 @@
 	    if (n && n2 / n != d2)
 	    {
 	      Loverflow:
-		error(loc, "index %lld overflow for static array", d1);
+		error(loc, "index %jd overflow for static array", d1);
 		dim = new IntegerExp(0, 1, tsize_t);
 	    }
 	}
@@ -1674,7 +1674,7 @@
 	    uinteger_t d = dim->toUInteger();
 
 	    if (d >= tt->arguments->dim)
-	    {	error(loc, "tuple index %llu exceeds %u", d, tt->arguments->dim);
+	    {	error(loc, "tuple index %ju exceeds %u", d, tt->arguments->dim);
 		return Type::terror;
 	    }
 	    Argument *arg = (Argument *)tt->arguments->data[(size_t)d];
@@ -1695,7 +1695,7 @@
 {
     buf->writeByte(mangleChar[ty]);
     if (dim)
-	buf->printf("%llu", dim->toInteger());
+	buf->printf("%ju", dim->toInteger());
     if (next)
 	next->toDecoBuffer(buf);
 }
@@ -4528,7 +4528,7 @@
     OutBuffer buf2;
     Argument::argsToDecoBuffer(&buf2, arguments);
     unsigned len = buf2.offset;
-    buf->printf("%c%d%.*s", mangleChar[ty], len, len, buf2.extractData());
+    buf->printf("%c%d%.*s", mangleChar[ty], len, len, (char*) buf2.extractData());
 }
 
 Expression *TypeTuple::getProperty(Loc loc, Identifier *ident)
@@ -4589,7 +4589,7 @@
     uinteger_t i2 = upr->toUInteger();
 
     if (!(i1 <= i2 && i2 <= tt->arguments->dim))
-    {	error(loc, "slice [%llu..%llu] is out of range of [0..%u]", i1, i2, tt->arguments->dim);
+    {	error(loc, "slice [%ju..%ju] is out of range of [0..%u]", i1, i2, tt->arguments->dim);
 	return Type::terror;
     }
 
diff -u dmd-0.174/optimize.c dmd-0.174-format_string/optimize.c
--- dmd-0.174/optimize.c	2006-10-28 15:50:42.000000000 +0200
+++ dmd-0.174-format_string/optimize.c	2006-11-15 15:51:06.000000000 +0100
@@ -106,7 +106,7 @@
 		TypeSArray *ts = (TypeSArray *)ve->type;
 		integer_t dim = ts->dim->toInteger();
 		if (index < 0 || index >= dim)
-		    error("array index %lld is out of bounds [0..%lld]", index, dim);
+		    error("array index %jd is out of bounds [0..%ju]", index, dim);
 		e = new SymOffExp(loc, ve->var, index * ts->next->size());
 		e->type = type;
 		return e;
@@ -329,7 +329,7 @@
 	uinteger_t i = e2->toInteger();
 
 	if (i >= es1->len)
-	    error("string index %llu is out of bounds [0 .. %u]", i, es1->len);
+	    error("string index %jd is out of bounds [0 .. %zu]", i, es1->len);
 	else
 	{   integer_t value;
 
@@ -360,7 +360,7 @@
 	uinteger_t i = e2->toInteger();
 
 	if (i >= length)
-	{   error("array index %llu is out of bounds [0 .. %llu]", i, length);
+	{   error("array index %ju is out of bounds [0 .. %ju]", i, length);
 	}
 	else if (e1->op == TOKarrayliteral && !e1->checkSideEffect(2))
 	{   ArrayLiteralExp *ale = (ArrayLiteralExp *)e1;
@@ -387,7 +387,7 @@
 	uinteger_t iupr = upr->toInteger();
 
 	if (iupr > es1->len || ilwr > iupr)
-	    error("string slice [%llu .. %llu] is out of bounds", ilwr, iupr);
+	    error("string slice [%ju .. %ju] is out of bounds", ilwr, iupr);
 	else
 	{   integer_t value;
 	    void *s;
@@ -414,7 +414,7 @@
 	uinteger_t iupr = upr->toInteger();
 
 	if (iupr > es1->elements->dim || ilwr > iupr)
-	    error("array slice [%llu .. %llu] is out of bounds", ilwr, iupr);
+	    error("array slice [%ju .. %ju] is out of bounds", ilwr, iupr);
 	else
 	{
 	    memmove(es1->elements->data,
diff -u dmd-0.174/root.c dmd-0.174-format_string/root.c
--- dmd-0.174/root.c	2006-10-04 23:47:38.000000000 +0200
+++ dmd-0.174-format_string/root.c	2006-11-15 15:51:06.000000000 +0100
@@ -1326,7 +1326,7 @@
 void File::checkoffset(size_t offset, size_t nbytes)
 {
     if (offset > len || offset + nbytes > len)
-	error("Corrupt file '%s': offset x%x off end of file",toChars(),offset);
+	error("Corrupt file '%s': offset x%zx off end of file",toChars(),offset);
 }
 
 char *File::toChars()
diff -u dmd-0.174/statement.c dmd-0.174-format_string/statement.c
--- dmd-0.174/statement.c	2006-11-13 15:51:40.000000000 +0100
+++ dmd-0.174-format_string/statement.c	2006-11-15 15:51:06.000000000 +0100
@@ -1730,7 +1730,7 @@
                 if (e->op == TOKstring)
                 {
                     StringExp *se = (StringExp *)e;
-                    fprintf(stdmsg, "%.*s", se->len, se->string);
+                    fprintf(stdmsg, "%.*s", (int)se->len, se->string);
                 }
                 else
 		    error("string expected for message, not '%s'", e->toChars());
diff -u dmd-0.174/template.c dmd-0.174-format_string/template.c
--- dmd-0.174/template.c	2006-11-13 11:15:10.000000000 +0100
+++ dmd-0.174-format_string/template.c	2006-11-15 15:51:06.000000000 +0100
@@ -2941,7 +2941,7 @@
 
     //printf("TemplateInstance::genIdent('%s')\n", tempdecl->ident->toChars());
     id = tempdecl->ident->toChars();
-    buf.printf("__T%d%s", strlen(id), id);
+    buf.printf("__T%zu%s", strlen(id), id);
     args = tiargs;
     for (int i = 0; i < args->dim; i++)
     {   Object *o = (Object *)args->data[i];
@@ -3002,7 +3002,7 @@
 	    else
 	    {
 		char *p = sa->mangle();
-		buf.printf("%d%s", strlen(p), p);
+		buf.printf("%zu%s", strlen(p), p);
 	    }
 	}
 	else if (va)
