Patchwork [Fortran,committed] PR 45323 - cast argument of "touppper" to int

login
register
mail settings
Submitter Tobias Burnus
Date Aug. 23, 2010, 12:40 p.m.
Message ID <4C726C26.1040000@net-b.de>
Download mbox | patch
Permalink /patch/62479/
State New
Headers show

Comments

Tobias Burnus - Aug. 23, 2010, 12:40 p.m.
alphaev67-dec-osf5.1 showed warnings like:

/home/jayk/src/gcc-4.5.1/libgfortran/io/write.c: In function 
'nml_write_obj':
/home/jayk/src/gcc-4.5.1/libgfortran/io/write.c:1504:8: warning: array 
subscript has type 'char'

Committed as obvious to the trunk (Rev. 163469).
I don't plan to fix it on the 4.5 branch - but feel free to backport it.

Tobias

Patch

Index: libgfortran/ChangeLog
===================================================================
--- libgfortran/ChangeLog	(revision 163468)
+++ libgfortran/ChangeLog	(working copy)
@@ -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.
Index: libgfortran/io/write.c
===================================================================
--- libgfortran/io/write.c	(revision 163468)
+++ libgfortran/io/write.c	(working copy)
@@ -1703,14 +1703,14 @@  nml_write_obj (st_parameter_dt *dtp, nam
 	  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);
     }