The recent LTO patches broke Solaris bootstrap (both sparc and x86):

/vol/gcc/src/hg/trunk/local/gcc/lto/lto-common.c: In function 
'lto_file_decl_data* lto_file_read(lto_file*, std::FILE*, int*)':
/vol/gcc/src/hg/trunk/local/gcc/lto/lto-common.c:2114:32: error: format '%ld' 
expects argument of type 'long int', but argument 4 has type 'intptr_t' {aka 
'int'} [-Werror=format=]
 2114 |       fprintf (stdout, "%2d %8ld %8ld   %s\n",
      |                             ~~~^
      |                                |
      |                                long int
      |                             %8d
 2115 |         ++i, section->start, section->len, section->name);
      |              ~~~~~~~~~~~~~~
      |                       |
      |                       intptr_t {aka int}

/vol/gcc/src/hg/trunk/local/gcc/lto/lto-common.c:2114:37: error: format '%ld' 
expects argument of type 'long int', but argument 5 has type 'std::size_t' {aka 
'unsigned int'} [-Werror=format=]
 2114 |       fprintf (stdout, "%2d %8ld %8ld   %s\n",
      |                                  ~~~^
      |                                     |
      |                                     long int
      |                                  %8d
 2115 |         ++i, section->start, section->len, section->name);
      |                              ~~~~~~~~~~~~
      |                                       |
      |                                       std::size_t {aka unsigned int}

/vol/gcc/src/hg/trunk/local/gcc/lto/lto-dump.c: In member function 'virtual 
void symbol_entry::dump()':
/vol/gcc/src/hg/trunk/local/gcc/lto/lto-dump.c:63:25: error: format '%lu' 
expects argument of type 'long unsigned int', but argument 4 has type 
'std::size_t' {aka 'unsigned int'} [-Werror=format=]
   63 |     printf ("%s  %s  %4lu  %s  ", type_name, visibility, sz, name);
      |                      ~~~^                                ~~
      |                         |                                |
      |                         long unsigned int                std::size_t 
{aka unsigned int}
      |                      %4u

Fixed as follows.  i386-pc-solaris2.11 bootstrap has completed with this
patch, sparc-sun-solaris2.11 is running the testsuite and
x86_64-pc-linux-gnu is building the runtime libs.

Ok for mainline?

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-05-06  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        * lto-common.c (lto_file_read): Cast section->start, section->len
        to match format.
        * lto-dump.c (symbol_entry::dump): Cast sz to match format.

# HG changeset patch
# Parent  48cc59b91c89bd75e69175e99802075208e54e51
Fix Solaris bootstrap: lto-common.c, lto-dump.c format mismatches

diff --git a/gcc/lto/lto-common.c b/gcc/lto/lto-common.c
--- a/gcc/lto/lto-common.c
+++ b/gcc/lto/lto-common.c
@@ -2111,8 +2111,9 @@ lto_file_read (lto_file *file, FILE *res
     fprintf (stdout, "\n    LTO Object Name: %s\n", file->filename);
     fprintf (stdout, "\nNo.    Offset    Size       Section Name\n\n");
     for (section = section_list.first; section != NULL; section = section->next)
-      fprintf (stdout, "%2d %8ld %8ld   %s\n",
-	       ++i, section->start, section->len, section->name);
+      fprintf (stdout, "%2d %8ld %8lu   %s\n",
+	       ++i, (long) section->start, (unsigned long) section->len,
+	       section->name);
   }
 
   /* Find all sub modules in the object and put their sections into new hash
diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c
--- a/gcc/lto/lto-dump.c
+++ b/gcc/lto/lto-dump.c
@@ -60,7 +60,8 @@ struct symbol_entry
     const char *type_name = node->get_symtab_type_string ();
     const char *visibility = node->get_visibility_string ();
     size_t sz = get_size ();
-    printf ("%s  %s  %4lu  %s  ", type_name, visibility, sz, name);
+    printf ("%s  %s  %4lu  %s  ", type_name, visibility, (unsigned long) sz,
+	    name);
   }
 };
 

Reply via email to