Index: gcc/defaults.h
===================================================================
--- gcc/defaults.h	(revision 134439)
+++ gcc/defaults.h	(working copy)
@@ -423,6 +423,68 @@
 #define LONG_TYPE_SIZE BITS_PER_WORD
 #endif
 
+
+/* Defaults for int_fastN_t types.  We choose them such that we use
+   the smallest of the char, int, long int and long long int types
+   that is at least N bits in size.  */
+
+#ifndef INT_FAST8_TYPE
+#if CHAR_TYPE_SIZE >= 8
+#define INT_FAST8_TYPE "char"
+#elif INT_TYPE_SIZE >= 8
+#define INT_FAST8_TYPE "int"
+#elif LONG_TYPE_SIZE >= 8
+#define INT_FAST8_TYPE "long int"
+#elif LONG_LONG_TYPE_SIZE >= 8
+#define INT_FAST8_TYPE "long long int"
+#else
+#undef INT_FAST8_TYPE
+#endif
+#endif
+
+#ifndef INT_FAST16_TYPE
+#if CHAR_TYPE_SIZE >= 16
+#define INT_FAST16_TYPE "char"
+#elif INT_TYPE_SIZE >= 16
+#define INT_FAST16_TYPE "int"
+#elif LONG_TYPE_SIZE >= 16
+#define INT_FAST16_TYPE "long int"
+#elif LONG_LONG_TYPE_SIZE >= 16
+#define INT_FAST16_TYPE "long long int"
+#else
+#undef INT_FAST16_TYPE
+#endif
+#endif
+
+#ifndef INT_FAST32_TYPE
+#if CHAR_TYPE_SIZE >= 32
+#define INT_FAST32_TYPE "char"
+#elif INT_TYPE_SIZE >= 32
+#define INT_FAST32_TYPE "int"
+#elif LONG_TYPE_SIZE >= 32
+#define INT_FAST32_TYPE "long int"
+#elif LONG_LONG_TYPE_SIZE >= 32
+#define INT_FAST32_TYPE "long long int"
+#else
+#undef INT_FAST32_TYPE
+#endif
+#endif
+
+#ifndef INT_FAST64_TYPE
+#if CHAR_TYPE_SIZE >= 64
+#define INT_FAST64_TYPE "char"
+#elif INT_TYPE_SIZE >= 64
+#define INT_FAST64_TYPE "int"
+#elif LONG_TYPE_SIZE >= 64
+#define INT_FAST64_TYPE "long int"
+#elif LONG_LONG_TYPE_SIZE >= 64
+#define INT_FAST64_TYPE "long long int"
+#else
+#undef INT_FAST64_TYPE
+#endif
+#endif
+
+
 #ifndef LONG_LONG_TYPE_SIZE
 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
 #endif
Index: gcc/config/alpha/linux.h
===================================================================
--- gcc/config/alpha/linux.h	(revision 134439)
+++ gcc/config/alpha/linux.h	(working copy)
@@ -85,3 +85,17 @@
 
 /* Define if long doubles should be mangled as 'g'.  */
 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
+
+/* On Linux, the int_fastN_t types have the following sizes.  */
+#if LONG_TYPE_SIZE == 64
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "long int"
+#define INT_FAST32_TYPE "long int"
+#define INT_FAST64_TYPE "long int"
+#else
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+#endif
+
Index: gcc/config/linux.h
===================================================================
--- gcc/config/linux.h	(revision 134439)
+++ gcc/config/linux.h	(working copy)
@@ -130,3 +130,17 @@
 #define TARGET_HAS_SINCOS (OPTION_GLIBC)
 
 #define TARGET_POSIX_IO
+
+/* On Linux, the int_fastN_t types have the following sizes.  */
+#if LONG_TYPE_SIZE == 64
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "long int"
+#define INT_FAST32_TYPE "long int"
+#define INT_FAST64_TYPE "long int"
+#else
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+#endif
+
Index: gcc/config/sparc/linux.h
===================================================================
--- gcc/config/sparc/linux.h	(revision 134439)
+++ gcc/config/sparc/linux.h	(working copy)
@@ -246,3 +246,17 @@
 
 /* Define if long doubles should be mangled as 'g'.  */
 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
+
+/* On Linux, the int_fastN_t types have the following sizes.  */
+#if LONG_TYPE_SIZE == 64
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "long int"
+#define INT_FAST32_TYPE "long int"
+#define INT_FAST64_TYPE "long int"
+#else
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+#endif
+
Index: gcc/config/i386/mingw32.h
===================================================================
--- gcc/config/i386/mingw32.h	(revision 134439)
+++ gcc/config/i386/mingw32.h	(working copy)
@@ -135,6 +135,12 @@
 #undef WINT_TYPE
 #define WINT_TYPE "short unsigned int"
 
+/* On Windows, the int_fastN_t types have size N.  */
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "short int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+
 /* mingw32 uses the  -mthreads option to enable thread support.  */
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS "%{fopenmp: -mthreads}"
Index: gcc/config/sol2-10.h
===================================================================
--- gcc/config/sol2-10.h	(revision 134439)
+++ gcc/config/sol2-10.h	(working copy)
@@ -21,3 +21,10 @@
 /* Solaris 10 has the float and long double forms of math functions.  */
 #undef TARGET_C99_FUNCTIONS
 #define TARGET_C99_FUNCTIONS 1
+
+/* Starting with Solaris 10, the int_fastN_t types are defined.  */
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+
Index: gcc/config/rs6000/linux.h
===================================================================
--- gcc/config/rs6000/linux.h	(revision 134439)
+++ gcc/config/rs6000/linux.h	(working copy)
@@ -128,3 +128,17 @@
 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
 #endif
+
+/* On Linux, the int_fastN_t types have the following sizes.  */
+#if LONG_TYPE_SIZE == 64
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "long int"
+#define INT_FAST32_TYPE "long int"
+#define INT_FAST64_TYPE "long int"
+#else
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+#endif
+
Index: gcc/config/rs6000/aix.h
===================================================================
--- gcc/config/rs6000/aix.h	(revision 134439)
+++ gcc/config/rs6000/aix.h	(working copy)
@@ -256,3 +256,10 @@
 
 /* WINT_TYPE */
 #define WINT_TYPE "int"
+
+/* On AIX, the int_fastN_t types have size N.  */
+#define INT_FAST8_TYPE_SIZE "char"
+#define INT_FAST16_TYPE_SIZE "short int"
+#define INT_FAST32_TYPE_SIZE "int"
+#define INT_FAST64_TYPE_SIZE "long long int"
+
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 134439)
+++ gcc/config/darwin.h	(working copy)
@@ -72,6 +72,12 @@
 #undef	WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
+/* On MacOS, the int_fastN_t types have size N.  */
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "short int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+
 /* Default to using the NeXT-style runtime, since that's what is
    pre-installed on Darwin systems.  */
 
Index: gcc/config/mips/iris6.h
===================================================================
--- gcc/config/mips/iris6.h	(revision 134439)
+++ gcc/config/mips/iris6.h	(working copy)
@@ -116,3 +116,9 @@
 #undef SUBTARGET_CPP_SPEC
 #define SUBTARGET_CPP_SPEC "%{pthread:-D_REENTRANT}"
 
+/* On IRIX 6.x, the int_fastN_t types have size N.  */
+#define INT_FAST8_TYPE_SIZE "char"
+#define INT_FAST16_TYPE_SIZE "short int"
+#define INT_FAST32_TYPE_SIZE "int"
+#define INT_FAST64_TYPE_SIZE "long long int"
+
Index: gcc/config/openbsd.h
===================================================================
--- gcc/config/openbsd.h	(revision 134439)
+++ gcc/config/openbsd.h	(working copy)
@@ -306,5 +306,10 @@
     perror ("mprotect of trampoline code");				\
 }
 
+#define INT_FAST8_TYPE "int"
+#define INT_FAST16_TYPE "int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+
 #include <sys/types.h>
 #include <sys/mman.h>
Index: gcc/fortran/iso-c-binding.def
===================================================================
--- gcc/fortran/iso-c-binding.def	(revision 134439)
+++ gcc/fortran/iso-c-binding.def	(working copy)
@@ -75,12 +75,35 @@
 NAMED_INTCST (ISOCBINDING_INT_LEAST64_T, "c_int_least64_t", \
               get_int_kind_from_minimal_width (64))
 
-/* TODO: Implement c_int_fast*_t. Depends on PR 448.  */ 
+#ifdef INT_FAST8_TYPE
+NAMED_INTCST (ISOCBINDING_INT_FAST8_T, "c_int_fast8_t", \
+              gfc_get_int_kind_from_name (INT_FAST8_TYPE))
+#else
 NAMED_INTCST (ISOCBINDING_INT_FAST8_T, "c_int_fast8_t", -2)
+#endif
+
+#ifdef INT_FAST16_TYPE > 0
+NAMED_INTCST (ISOCBINDING_INT_FAST16_T, "c_int_fast16_t", \
+              gfc_get_int_kind_from_name (INT_FAST16_TYPE))
+#else
 NAMED_INTCST (ISOCBINDING_INT_FAST16_T, "c_int_fast16_t", -2)
+#endif
+
+#ifdef INT_FAST32_TYPE > 0
+NAMED_INTCST (ISOCBINDING_INT_FAST32_T, "c_int_fast32_t", \
+              gfc_get_int_kind_from_name (INT_FAST32_TYPE))
+#else
 NAMED_INTCST (ISOCBINDING_INT_FAST32_T, "c_int_fast32_t", -2)
+#endif
+
+#ifdef INT_FAST64_TYPE > 0
+NAMED_INTCST (ISOCBINDING_INT_FAST64_T, "c_int_fast64_t", \
+              gfc_get_int_kind_from_name (INT_FAST64_TYPE))
+#else
 NAMED_INTCST (ISOCBINDING_INT_FAST64_T, "c_int_fast64_t", -2)
+#endif
 
+
 NAMED_REALCST (ISOCBINDING_FLOAT, "c_float", \
                get_real_kind_from_node (float_type_node))
 NAMED_REALCST (ISOCBINDING_DOUBLE, "c_double", \
Index: gcc/fortran/trans-types.c
===================================================================
--- gcc/fortran/trans-types.c	(revision 134439)
+++ gcc/fortran/trans-types.c	(working copy)
@@ -196,7 +196,26 @@
   return -2;
 }
 
+static int
+gfc_get_int_kind_from_name (const char *name)
+{
+  tree node;
 
+  if (strncmp (name, "char", 4) == 0)
+    node = char_type_node;
+  else if (strncmp (name, "short", 5) == 0)
+    node = short_integer_type_node;
+  else if (strncmp (name, "int", 3) == 0)
+    node = integer_type_node;
+  else if (strncmp (name, "long int", 8) == 0)
+    node = long_integer_type_node;
+  else if (strncmp (name, "long long int", 13) == 0)
+    node = long_long_integer_type_node;
+
+  return get_int_kind_from_node (node);
+}
+
+
 /* Generate the CInteropKind_t objects for the C interoperable
    kinds.  */
 
@@ -645,26 +664,7 @@
   return new_type;
 }
 
-#if 0
-/* Return the bit size of the C "size_t".  */
 
-static unsigned int
-c_size_t_size (void)
-{
-#ifdef SIZE_TYPE  
-  if (strcmp (SIZE_TYPE, "unsigned int") == 0)
-    return INT_TYPE_SIZE;
-  if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
-    return LONG_TYPE_SIZE;
-  if (strcmp (SIZE_TYPE, "short unsigned int") == 0)
-    return SHORT_TYPE_SIZE;
-  gcc_unreachable ();
-#else
-  return LONG_TYPE_SIZE;
-#endif
-}
-#endif
-
 /* Create the backend type nodes. We map them to their
    equivalent C type, at least for now.  We also give
    names to the types here, and we push them in the
