diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index eae41d236f6600a56b98ad76970e8a5ef08f7b96..c79027adcb74c721218ffaeb3ff1b6c32b115c28 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-23  Tobias Burnus  <burnus@net-b.de>
+
+	PR fortran/45323
+	* io/write.c (nml_write_obj, namelist_write): Cast argument
+	of toupper to int.
+
 2010-08-21  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
 	* configure: Regenerate.
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 775425d6d776af238fc5d5266aab6bffdc8c96f4..e811c47baefb8dbf24e36a0a971a69707213a1c8 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1703,14 +1703,14 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
 	  base_name_len = strlen (base_name);
 	  for (dim_i = 0; dim_i < base_name_len; dim_i++)
             {
-	      cup = toupper (base_name[dim_i]);
+	      cup = toupper ((int) base_name[dim_i]);
 	      write_character (dtp, &cup, 1, 1);
             }
 	}
       clen = strlen (obj->var_name);
       for (dim_i = len; dim_i < clen; dim_i++)
 	{
-	  cup = toupper (obj->var_name[dim_i]);
+	  cup = toupper ((int) obj->var_name[dim_i]);
 	  write_character (dtp, &cup, 1, 1);
 	}
       write_character (dtp, "=", 1, 1);
@@ -1959,7 +1959,7 @@ namelist_write (st_parameter_dt *dtp)
   /* Write namelist name in upper case - f95 std.  */
   for (i = 0 ;i < dtp->namelist_name_len ;i++ )
     {
-      c = toupper (dtp->namelist_name[i]);
+      c = toupper ((int) dtp->namelist_name[i]);
       write_character (dtp, &c, 1 ,1);
     }