diff --git a/src/attrib.c b/src/attrib.c
index ae86ba7..6043f8b 100644
--- a/src/attrib.c
+++ b/src/attrib.c
@@ -929,7 +929,7 @@ void PragmaDeclaration::semantic(Scope *sc)
                     fprintf(stdmsg, "%.*s", (int)se->len, (char *)se->string);
                 }
                 else
-                    fprintf(stdmsg, e->toChars());
+                    fprintf(stdmsg, "%s", e->toChars());
             }
             fprintf(stdmsg, "\n");
         }
diff --git a/src/backend/cgcod.c b/src/backend/cgcod.c
index 4f6c77b..2575c4f 100644
--- a/src/backend/cgcod.c
+++ b/src/backend/cgcod.c
@@ -1884,7 +1884,7 @@ L3:
         {
 #ifdef DEBUG
             WRTYxx(tym);
-            printf("\nallocreg: fil %s lin %d, regcon.mvar x%x msavereg x%x *pretregs x%x, reg %d, tym x%x\n",
+            printf("\nallocreg: fil %s lin %d, regcon.mvar x%x msavereg x%x *pretregs x%x, reg %d, tym x%lx\n",
                 file,line,regcon.mvar,msavereg,*pretregs,*preg,tym);
 #endif
             assert(0);
@@ -2386,7 +2386,7 @@ if (regcon.cse.mval & 1) elem_print(regcon.cse.value[i]);
 #if DEBUG
                 if (EOP(e))
                 {
-                    printf("e = x%lx, op = x%x, emask = x%x, csemask = x%x\n",
+                    printf("e = x%p, op = x%x, emask = x%x, csemask = x%x\n",
                         e,e->Eoper,emask,csemask);
                     //printf("mMSW = x%x, mLSW = x%x\n", mMSW, mLSW);
                     elem_print(e);
@@ -2442,14 +2442,14 @@ if (regcon.cse.mval & 1) elem_print(regcon.cse.value[i]);
         }
         if (!EOP(e)) goto reload;
 #if DEBUG
-        printf("e = x%lx, csemask = x%x, emask = x%x\n",e,csemask,emask);
+        printf("e = x%p, csemask = x%x, emask = x%x\n",e,csemask,emask);
 #endif
         assert(0);
   }
   else
   {
 #if DEBUG
-        printf("e = x%p, tym = x%x\n",e,tym);
+        printf("e = x%p, tym = x%lx\n",e,tym);
 #endif
         assert(0);
   }
@@ -2665,7 +2665,7 @@ L1:
 
 #ifdef DEBUG
 
-char *regm_str(regm_t rm)
+const char *regm_str(regm_t rm)
 {
     #define NUM 4
     #define SMAX 30
diff --git a/src/backend/cgen.c b/src/backend/cgen.c
index a03558d..0d3f52e 100644
--- a/src/backend/cgen.c
+++ b/src/backend/cgen.c
@@ -247,7 +247,7 @@ code *genmovreg(code *c,unsigned to,unsigned from)
 {
 #if DEBUG
         if (to > ES || from > ES)
-                printf("genmovreg(c = x%lx, to = %d, from = %d)\n",c,to,from);
+                printf("genmovreg(c = x%p, to = %d, from = %d)\n",c,to,from);
 #endif
         assert(to <= ES && from <= ES);
         if (to != from)
diff --git a/src/backend/cgreg.c b/src/backend/cgreg.c
index 9d1e7c4..2e14f20 100644
--- a/src/backend/cgreg.c
+++ b/src/backend/cgreg.c
@@ -920,7 +920,7 @@ int cgreg_assign(Symbol *retsym)
 
         #ifdef DEBUG
             if (debugr)
-            {   printf("symbol '%3s', ty x%x weight x%x sz %d\n   ",
+            {   printf("symbol '%3s', ty x%lx weight x%x sz %d\n   ",
                 s->Sident,ty,s->Sweight,sz);
                 vec_println(s->Srange);
             }
diff --git a/src/backend/cgsched.c b/src/backend/cgsched.c
index 6d5c58f..20bcdf1 100644
--- a/src/backend/cgsched.c
+++ b/src/backend/cgsched.c
@@ -3146,7 +3146,7 @@ code *simpleops(code *c,regm_t scratch)
 }
 
 #if DEBUG
-static char *fpops[] = {"fstp","fld","fop"};
+static const char *fpops[] = {"fstp","fld","fop"};
 void Cinfo::print()
 {
     Cinfo *ci = this;
@@ -3157,7 +3157,7 @@ void Cinfo::print()
         return;
     }
 
-    printf("Cinfo %x:  c %x, pair %x, sz %d, isz %d, flags - ",
+    printf("Cinfo %p:  c %p, pair %x, sz %d, isz %d, flags - ",
            ci,c,pair,sz,isz);
     if (ci->flags & CIFLarraybounds)
         printf("arraybounds,");
@@ -3169,7 +3169,7 @@ void Cinfo::print()
         printf("push,");
     if (ci->flags & ~(CIFLarraybounds|CIFLnostage|CIFLpush|CIFLea))
         printf("bad flag,");
-    printf("\n\tr %x w %x a %x reg %x uops %x sibmodrm %x spadjust %d\n",
+    printf("\n\tr %lx w %lx a %lx reg %x uops %x sibmodrm %x spadjust %ld\n",
             r,w,a,reg,uops,sibmodrm,spadjust);
     if (ci->fp_op)
         printf("\tfp_op %s, fxch_pre %x, fxch_post %x\n",
diff --git a/src/backend/cod1.c b/src/backend/cod1.c
index 3ba154f..0427cd9 100644
--- a/src/backend/cod1.c
+++ b/src/backend/cod1.c
@@ -529,7 +529,7 @@ code *loadea(elem *e,code __ss *cs,unsigned op,unsigned reg,targ_size_t offset,
 
 #ifdef DEBUG
   if (debugw)
-    printf("loadea: e=x%p cs=x%x op=x%x reg=%d offset=%ld keepmsk=x%x desmsk=x%x\n",
+    printf("loadea: e=x%p cs=x%p op=x%x reg=%d offset=%ld keepmsk=x%x desmsk=x%x\n",
             e,cs,op,reg,offset,keepmsk,desmsk);
 #endif
 
@@ -1572,7 +1572,7 @@ code *tstresult(regm_t regm,tym_t tym,unsigned saveflag)
 
 #ifdef DEBUG
   if (!(regm & (mBP | ALLREGS)))
-        printf("tstresult(regm = x%x, tym = x%x, saveflag = %d)\n",
+        printf("tstresult(regm = x%x, tym = x%lx, saveflag = %d)\n",
             regm,tym,saveflag);
 #endif
   assert(regm & (mBP | ALLREGS));
diff --git a/src/backend/cod3.c b/src/backend/cod3.c
index 61c7f0f..09a3a7f 100644
--- a/src/backend/cod3.c
+++ b/src/backend/cod3.c
@@ -3640,7 +3640,7 @@ targ_size_t codout(code *c)
   symbol *s;
 
 #ifdef DEBUG
-  if (debugc) printf("codout(%p), Coffset = x%x\n",c,Coffset);
+  if (debugc) printf("codout(%p), Coffset = x%lx\n",c,Coffset);
 #endif
 
   pgen = bytes;
diff --git a/src/backend/cod4.c b/src/backend/cod4.c
index 3d7c06a..47a3f41 100644
--- a/src/backend/cod4.c
+++ b/src/backend/cod4.c
@@ -2699,7 +2699,7 @@ code *cdlngsht(elem *e,regm_t *pretregs)
 #ifdef DEBUG
   if (!(!*pretregs || retregs))
         WROP(e->Eoper),
-        printf(" *pretregs = x%x, retregs = x%x, e = x%x\n",*pretregs,retregs,e);
+        printf(" *pretregs = x%x, retregs = x%x, e = x%p\n",*pretregs,retregs,e);
 #endif
   assert(!*pretregs || retregs);
   return cat(c,fixresult(e,retregs,pretregs));  /* lsw only             */
diff --git a/src/backend/code.h b/src/backend/code.h
index 47e3433..a039dcc 100644
--- a/src/backend/code.h
+++ b/src/backend/code.h
@@ -528,7 +528,7 @@ void cssave (elem *e , regm_t regm , unsigned opsflag );
 bool evalinregister (elem *e );
 regm_t getscratch();
 code *codelem (elem *e , regm_t *pretregs , bool constflag );
-char *regm_str(regm_t rm);
+const char *regm_str(regm_t rm);
 
 /* cod1.c */
 extern int clib_inited;
diff --git a/src/backend/debug.c b/src/backend/debug.c
index 2764921..c25ac30 100644
--- a/src/backend/debug.c
+++ b/src/backend/debug.c
@@ -107,7 +107,7 @@ void WRTYxx(tym_t t)
 #endif
     t = tybasic(t);
     if (t >= TYMAX)
-    {   dbg_printf("TY %x\n",t);
+    {   dbg_printf("TY %lx\n",t);
         assert(0);
     }
     dbg_printf("TY%s ",tystring[tybasic(t)]);
@@ -137,10 +137,8 @@ void WRarglst(list_t a)
 
   if (!a) dbg_printf("0 args\n");
   while (a)
-  {     if (list_ptr(a))
-            dbg_printf("arg %d: '%s'\n",n,list_ptr(a));
-        else
-            dbg_printf("arg %d: NULL\n",n);
+  {     const char* c = (const char*)list_ptr(a);
+        dbg_printf("arg %d: '%s'\n",n,c?c:"NULL");
         a = a->next;
         n++;
   }
@@ -187,7 +185,7 @@ void WReqn(elem *e)
         ferr(" ");
         WROP(e->Eoper);
         if (e->Eoper == OPstreq)
-            dbg_printf("%d",e->Enumbytes);
+            dbg_printf("%ld",e->Enumbytes);
         ferr(" ");
         if (OTbinary(e->E2->Eoper))
         {       nest++;
@@ -212,7 +210,7 @@ void WReqn(elem *e)
                         dbg_printf("%g ",e->EV.Vdouble);
                         break;
                     default:
-                        dbg_printf("%ld ",el_tolong(e));
+                        dbg_printf("%lld ",el_tolong(e));
                         break;
                 }
                 break;
@@ -224,7 +222,7 @@ void WReqn(elem *e)
                 if (e->EV.sp.Vsym->Ssymnum != -1)
                     dbg_printf("(%d)",e->EV.sp.Vsym->Ssymnum);
                 if (e->Eoffset != 0)
-                        dbg_printf(".%d",e->Eoffset);
+                        dbg_printf(".%ld",e->Eoffset);
                 break;
             case OPasm:
 #if TARGET_MAC
@@ -240,7 +238,7 @@ void WReqn(elem *e)
             case OPstring:
                 dbg_printf("\"%s\"",e->EV.ss.Vstring);
                 if (e->EV.ss.Voffset)
-                    dbg_printf("+%d",e->EV.ss.Voffset);
+                    dbg_printf("+%ld",e->EV.ss.Voffset);
                 break;
             case OPmark:
             case OPgot:
@@ -377,7 +375,7 @@ void WRblock(block *b)
                 dbg_printf("\tdefault: %p\n",list_block(bl));
                 while (ncases--)
                 {   bl = list_next(bl);
-                    dbg_printf("\tcase %ld: %p\n",*++pu,list_block(bl));
+                    dbg_printf("\tcase %lld: %p\n",*++pu,list_block(bl));
                 }
                 break;
             case BCiftrue:
diff --git a/src/backend/el.c b/src/backend/el.c
index a9c88b9..6f7bc6d 100644
--- a/src/backend/el.c
+++ b/src/backend/el.c
@@ -3023,7 +3023,7 @@ void elem_print(elem *e)
  && (e->PEFflags & PEFstrsize)
 #endif
                )
-                dbg_printf("%d ",e->Enumbytes);
+                dbg_printf("%ld ",e->Enumbytes);
             WRTYxx(e->ET->Tty);
         }
   }
@@ -3031,7 +3031,7 @@ void elem_print(elem *e)
   {
         if ((e->Eoper == OPstrpar || e->Eoper == OPstrctor || e->Eoper == OPstreq) ||
             e->Ety == TYstruct)
-            dbg_printf("%d ",e->Enumbytes);
+            dbg_printf("%ld ",e->Enumbytes);
         WRTYxx(e->Ety);
   }
   if (OTunary(e->Eoper))
@@ -3045,7 +3045,7 @@ void elem_print(elem *e)
   else if (OTbinary(e->Eoper))
   {
         if (!PARSER && e->Eoper == OPstreq)
-                dbg_printf("bytes=%d ",e->Enumbytes);
+                dbg_printf("bytes=%ld ",e->Enumbytes);
         dbg_printf("%p %p\n",e->E1,e->E2);
         elem_print(e->E1);
         elem_print(e->E2);
@@ -3055,18 +3055,18 @@ void elem_print(elem *e)
         switch (e->Eoper)
         {
             case OPrelconst:
-                dbg_printf(" %d+&",e->Eoffset);
+                dbg_printf(" %ld+&",e->Eoffset);
                 dbg_printf(" %s",e->EV.sp.Vsym->Sident);
                 break;
             case OPvar:
                 if (e->Eoffset)
-                    dbg_printf(" %d+",e->Eoffset);
+                    dbg_printf(" %ld+",e->Eoffset);
                 dbg_printf(" %s",e->EV.sp.Vsym->Sident);
                 break;
             case OPasm:
             case OPstring:
             case OPhstring:
-                dbg_printf(" '%s',%d\n",e->EV.ss.Vstring,e->EV.ss.Voffset);
+                dbg_printf(" '%s',%ld\n",e->EV.ss.Vstring,e->EV.ss.Voffset);
                 break;
             case OPconst:
                 tym = tybasic(typemask(e));
@@ -3113,7 +3113,7 @@ void elem_print(elem *e)
                     case TYchar16:
                     L3:
 #if TX86
-                        dbg_printf("%hd ",e->EV.Vint);
+                        dbg_printf("%ld ",e->EV.Vint);
                         break;
 #endif
                     case TYlong:
diff --git a/src/backend/evalu8.c b/src/backend/evalu8.c
index 0d1202d..31e4112 100644
--- a/src/backend/evalu8.c
+++ b/src/backend/evalu8.c
@@ -1195,7 +1195,7 @@ elem * evalu8(elem *e)
                     break;
                 default:
 #ifdef DEBUG
-                    dbg_printf("tym = x%x\n",tym);
+                    dbg_printf("tym = x%lx\n",tym);
                     elem_print(e);
 #endif
                     assert(0);
diff --git a/src/backend/gloop.c b/src/backend/gloop.c
index 2c417be..cf4e006 100644
--- a/src/backend/gloop.c
+++ b/src/backend/gloop.c
@@ -3372,7 +3372,7 @@ STATIC void elimbasivs(register loop *l)
                         }
                 }
 
-                cmes3("No uses, eliminating basic IV '%s' (%d)\n",(X->Sident)
+                cmes3("No uses, eliminating basic IV '%s' (%p)\n",(X->Sident)
                         ? (char *)X->Sident : "",X);
 
                 /* Dump the increment elem                              */
@@ -3435,7 +3435,7 @@ STATIC void elimopeqs(register loop *l)
                 }
             }
 
-            cmes3("No uses, eliminating opeq IV '%s' (%d)\n",(X->Sident)
+            cmes3("No uses, eliminating opeq IV '%s' (%p)\n",(X->Sident)
                     ? (char *)X->Sident : "",X);
 
             // Dump the increment elem
@@ -3607,7 +3607,7 @@ STATIC elem ** onlyref(symbol *x,loop *l,elem *incn,int *prefcount)
   sincn = incn;
 #ifdef DEBUG
   if (!(X->Ssymnum < globsym.top && l && incn))
-        dbg_printf("X = %d, globsym.top = %d, l = x%lx, incn = x%lx\n",X->Ssymnum,globsym.top,l,incn);
+        dbg_printf("X = %d, globsym.top = %d, l = x%p, incn = x%p\n",X->Ssymnum,globsym.top,l,incn);
 #endif
   assert(X->Ssymnum < globsym.top && l && incn);
   count = 0;
diff --git a/src/backend/gother.c b/src/backend/gother.c
index 3b9ed85..543e965 100644
--- a/src/backend/gother.c
+++ b/src/backend/gother.c
@@ -538,7 +538,7 @@ STATIC elem * chkprop(elem *n,list_t rdlist)
                 WReqn(n);
                 dbg_printf(" replaced by ");
                 WReqn(foundelem);
-                dbg_printf("), x%lx to x%lx\n",foundelem,n);
+                dbg_printf("), x%p to x%p\n",foundelem,n);
         }
 #endif
         changes++;
diff --git a/src/backend/symbol.c b/src/backend/symbol.c
index bbea385..af60d52 100644
--- a/src/backend/symbol.c
+++ b/src/backend/symbol.c
@@ -123,7 +123,7 @@ void symbol_print(symbol *s)
 //  dbg_printf(" Ssize   = x%02x\n",s->Ssize);
     dbg_printf(" Soffset = x%04lx",s->Soffset);
     dbg_printf(" Sweight = %d",s->Sweight);
-    dbg_printf(" Sflags = x%04x",s->Sflags);
+    dbg_printf(" Sflags = x%04lx",s->Sflags);
     dbg_printf(" Sxtrnnum = %d\n",s->Sxtrnnum);
     dbg_printf("  Stype   = %p",s->Stype);
 #if SCPP
@@ -140,7 +140,7 @@ void symbol_print(symbol *s)
         type_print(s->Stype);
     if (s->Sclass == SCmember || s->Sclass == SCfield)
     {
-        dbg_printf("  Smemoff =%5d",s->Smemoff);
+        dbg_printf("  Smemoff =%5ld",s->Smemoff);
         dbg_printf("  Sbit    =%3d",s->Sbit);
         dbg_printf("  Swidth  =%3d\n",s->Swidth);
     }
diff --git a/src/backend/type.c b/src/backend/type.c
index ab95abf..2e6c412 100644
--- a/src/backend/type.c
+++ b/src/backend/type.c
@@ -64,7 +64,7 @@ targ_size_t type_size(type *t)
 #ifdef DEBUG
     if (tyb >= TYMAX)
         /*type_print(t),*/
-        dbg_printf("tyb = x%x\n",tyb);
+        dbg_printf("tyb = x%lx\n",tyb);
 #endif
     assert(tyb < TYMAX);
     s = tysize[tyb];
@@ -938,7 +938,7 @@ void type_print(type *t)
         tybasic(t->Tty) != TYmfunc &&
         tybasic(t->Tty) != TYarray &&
         tybasic(t->Tty) != TYtemplate)
-      dbg_printf(" Tsize=%d",type_size(t));
+      dbg_printf(" Tsize=%ld",type_size(t));
   dbg_printf(" Tnext=%p",t->Tnext);
   switch (tybasic(t->Tty))
   {     case TYstruct:
@@ -952,7 +952,7 @@ void type_print(type *t)
 #endif
             break;
         case TYarray:
-            dbg_printf(" Tdim=%d",t->Tdim);
+            dbg_printf(" Tdim=%ld",t->Tdim);
             break;
         case TYident:
             dbg_printf(" Tident='%s'",t->Tident);
diff --git a/src/iasm.c b/src/iasm.c
index a140281..0ab0cb0 100644
--- a/src/iasm.c
+++ b/src/iasm.c
@@ -857,7 +857,7 @@ STATIC opflag_t asm_determine_operand_flags(OPND *popnd)
                 return popnd->base->ty;
 #if DEBUG
         if (debuga)
-            printf("popnd->base = %s\n, popnd->pregDisp1 = %ld\n", popnd->base ? popnd->base->regstr : "NONE", popnd->pregDisp1);
+            printf("popnd->base = %s\n, popnd->pregDisp1 = %p\n", popnd->base ? popnd->base->regstr : "NONE", popnd->pregDisp1);
 #endif
         ps = popnd->s;
         Declaration *ds = ps ? ps->isDeclaration() : NULL;
@@ -1810,7 +1810,7 @@ STATIC int asm_is_fpreg(char *szReg)
 STATIC OPND *asm_merge_opnds(OPND *o1, OPND *o2)
 {
 #ifdef DEBUG
-    char *psz;
+    const char *psz;
 #endif
 #ifdef DEBUG
     if (debuga)
@@ -2272,7 +2272,7 @@ STATIC void asm_make_modrm_byte(
 
 #ifdef DEBUG
         if (debuga)
-            printf("This is an mod = %d, popnd->s =%ld, popnd->disp = %ld\n",
+            printf("This is an mod = %d, popnd->s =%p, popnd->disp = %ld\n",
                mrmb.modregrm.mod, s, popnd->disp);
 #endif
             if (!s || (!mrmb.modregrm.mod && popnd->disp))
diff --git a/src/statement.c b/src/statement.c
index 978ced6..75b6ee6 100644
--- a/src/statement.c
+++ b/src/statement.c
@@ -2536,7 +2536,7 @@ Statement *PragmaStatement::semantic(Scope *sc)
                     fprintf(stdmsg, "%.*s", (int)se->len, (char *)se->string);
                 }
                 else
-                    fprintf(stdmsg, e->toChars());
+                    fprintf(stdmsg, "%s", e->toChars());
             }
             fprintf(stdmsg, "\n");
         }
