diff mbox

[gomp4] Fix ptx warning

Message ID 55BF7D65.8000501@acm.org
State New
Headers show

Commit Message

Nathan Sidwell Aug. 3, 2015, 2:40 p.m. UTC
I've committed this to gomp4.  I  was reusing a size_t variable in a loop where 
unsigned would do, and fprintf got upset.

nathan
diff mbox

Patch

2015-08-03  Nathan Sidwell  <nathan@codesourcery.com>

	* config/nvptx/mkoffload.c (process): Avoid printf formatting
	warning.

Index: config/nvptx/mkoffload.c
===================================================================
--- config/nvptx/mkoffload.c	(revision 226504)
+++ config/nvptx/mkoffload.c	(working copy)
@@ -225,16 +225,16 @@  access_check (const char *name, int mode
 static void
 process (FILE *in, FILE *out)
 {
-  size_t len;
+  size_t len = 0;
   const char *input = read_file (in, &len);
   const char *comma;
   id_map const *id;
   unsigned obj_count = 0;
-  size_t i;
+  unsigned ix;
 
   /* Dump out char arrays for each PTX object file.  These are
      terminated by a NUL.  */
-  for (i = 0; i != len;)
+  for (size_t i = 0; i != len;)
     {
       char c;
       
@@ -280,8 +280,8 @@  process (FILE *in, FILE *out)
 	   "  const char *code;\n"
 	   "  __SIZE_TYPE__ size;\n"
 	   "} ptx_objs[] = {");
-  for (comma = "", i = 0; i != obj_count; comma = ",", i++)
-    fprintf (out, "%s\n\t{ptx_code_%u, sizeof (ptx_code_%u)}", comma, i, i);
+  for (comma = "", ix = 0; ix != obj_count; comma = ",", ix++)
+    fprintf (out, "%s\n\t{ptx_code_%u, sizeof (ptx_code_%u)}", comma, ix, ix);
   fprintf (out, "\n};\n\n");
 
   /* Dump out variable idents.  */