Bug 24028 - PPC_INT_FMT should be "ll" on Mojave.
Summary: PPC_INT_FMT should be "ll" on Mojave.
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
Depends on:
Reported: 2018-12-23 09:19 UTC by Pascal Bourguignon
Modified: 2019-01-23 01:53 UTC (History)
0 users

See Also:
Last reconfirmed: 2018-12-23 00:00:00

likely fix (995 bytes, patch)
2018-12-23 14:05 UTC, Alan Modra
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Bourguignon 2018-12-23 09:19:47 UTC
With binutils-gdb git head, compiling on Mojave, we get errors:
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I. -I../bfd -I./../include -I./../bfd -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I/usr/local/gcc/include -I/opt/local/include -MT ppc-dis.lo -MD -MP -MF .deps/ppc-dis.Tpo -c ppc-dis.c -o ppc-dis.o
ppc-dis.c: In function 'print_insn_powerpc':
ppc-dis.c:764:43: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int64_t' {aka 'long long int'} [-Werror=format=]
      (*info->fprintf_func) (info->stream, "r%" PPC_INT_FMT "d", value);
                                           ^~~~                  ~~~~~
ppc-dis.c:764:61: note: format string is defined here
      (*info->fprintf_func) (info->stream, "r%" PPC_INT_FMT "d", value);
ppc-dis.c:766:43: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int64_t' {aka 'long long int'} [-Werror=format=]
... etc ...
PPC_INT_FMT is defined to be "l" instead of "ll" because 
BFD_HOST_64BIT_LONG is defined as 1 (and BFD_HOST_64BIT_LONG_LONG as 0).
Comment 1 Alan Modra 2018-12-23 14:05:00 UTC
Created attachment 11490 [details]
likely fix

Actually, we shouldn't be using PPC_INT_FMT.  Does this patch cure the problem?
Comment 2 cvs-commit@gcc.gnu.org 2018-12-28 04:34:01 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:


commit d1a3c973fa1c0d7eead585e82e02db11daeb36cf
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Dec 28 09:31:42 2018 +1030

    PR24028, PPC_INT_FMT
    PPC_INT_FMT is redundant now that bfd.h pulls in inttypes.h if
    available.  Apparently MacOS Mojave defines int64_t as long long even
    though long is also 64 bits, which confuses the logic selecting
    PPC_INT_FMT (and BFD_PRI64 too).  Hopefully inttypes.h is available on
    	PR 24028
    	* opcode/ppc.h (PPC_INT_FMT): Delete.
    	* ppc-dis.c (print_insn_powerpc): Replace PPC_INT_FMT uses with
Comment 3 Alan Modra 2018-12-28 05:14:38 UTC
Please check current binutils git master.
Comment 4 Alan Modra 2019-01-23 01:53:54 UTC
Presumed fixed