Index: include/parrot/io.h
===================================================================
--- include/parrot/io.h	(revision 26507)
+++ include/parrot/io.h	(working copy)
@@ -123,6 +123,11 @@
 #define PIO_DOWNLAYER(x)   (x)->down
 #define PIO_UPLAYER(x)     (x)->up
 
+/* Macro to handle fd duplication calls _dup(), and casts
+ * input and output to proper values to avoid compiler 
+ * warnings.
+ */
+#define PIO_DUP_FD(x)      (PIOHANDLE)_dup((int)(x))
 
 /* Others to come */
 #ifdef PIO_OS_UNIX
Index: src/io/io.c
===================================================================
--- src/io/io.c	(revision 26507)
+++ src/io/io.c	(working copy)
@@ -177,7 +177,7 @@
 PIO_dup(PARROT_INTERP, ARGIN(PMC *pmc))
 {
     ParrotIO * const io   = PMC_data_typed(pmc, ParrotIO *);
-    const PIOHANDLE newfd = dup(io->fd);
+    const PIOHANDLE newfd = PIO_DUP_FD(io->fd);
     ParrotIOLayer * layer = (ParrotIOLayer *)PMC_struct_val(pmc);
 
     ParrotIO * newio;
@@ -186,12 +186,12 @@
         layer = interp->piodata->default_stack;
     }
 
-    if (newfd == -1) {
+    if (newfd == (PIOHANDLE)-1) {
         real_exception(interp, NULL, 1, "could not dup an fd");
     }
 
     newio = PIO_fdopen_down(interp, layer, newfd, io->flags);
-    /* io could be null here but we still have to
+    /* io could be null here but we still have
      * to create a PMC for the caller, no PMCNULL here
      * as that would cause an exception upon access.
      */
Index: src/io/io_unix.c
===================================================================
--- src/io/io_unix.c	(revision 26507)
+++ src/io/io_unix.c	(working copy)
@@ -1141,7 +1141,7 @@
             /* the other end is writing - we read from the pipe */
             close(STDIN_FILENO);
             close(fds[1]);
-            if (dup(fds[0]) != STDIN_FILENO) {
+            if (_dup(fds[0]) != STDIN_FILENO) {
                 exit(EXIT_SUCCESS);
             }
         }
@@ -1150,8 +1150,8 @@
             close(STDIN_FILENO);
             close(STDOUT_FILENO);
             close(STDERR_FILENO);
-            if (dup(fds[0]) != STDIN_FILENO || dup(fds[1]) != STDOUT_FILENO
-                    || dup(fds[1]) != STDERR_FILENO)
+            if (_dup(fds[0]) != STDIN_FILENO || _dup(fds[1]) != STDOUT_FILENO
+                    || _dup(fds[1]) != STDERR_FILENO)
             {
                 exit(EXIT_SUCCESS);
             }
