This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix Solaris bootstrap: lto-common.c, lto-dump.c format mismatches


On May 6, 2019 8:35:15 PM GMT+02:00, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:
>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?

Can you use the PRI* format macros to match the types instead?

Ok with that change. 

Richard. 

>	Rainer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]