From patchwork Wed Apr 24 18:59:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Durigan Junior X-Patchwork-Id: 32405 Received: (qmail 54404 invoked by alias); 24 Apr 2019 19:00:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 54220 invoked by uid 89); 24 Apr 2019 19:00:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Apr 2019 18:59:59 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 415BEF12B8 for ; Wed, 24 Apr 2019 18:59:58 +0000 (UTC) Received: from psique.yyz.redhat.com (unused-10-15-17-196.yyz.redhat.com [10.15.17.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F98861B99; Wed, 24 Apr 2019 18:59:54 +0000 (UTC) From: Sergio Durigan Junior To: GDB Patches Cc: Sergio Durigan Junior Subject: [obvious/pushed] Use "pulongest" on aarch64-tdep.c:aarch64_gdbarch_init Date: Wed, 24 Apr 2019 14:59:49 -0400 Message-Id: <20190424185949.9267-1-sergiodj@redhat.com> X-IsSubscribed: yes While trying to build GDB on i686, I found the following error: In file included from ../../gdb/common/common-defs.h:105, from ../../gdb/defs.h:28, from ../../gdb/aarch64-tdep.c:21: ../../gdb/aarch64-tdep.c: In function 'gdbarch* aarch64_gdbarch_init(gdbarch_info, gdbarch_list*)': ../../gdb/aarch64-tdep.c:3176:43: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'uint64_t' {aka 'long long unsigned int'} [-Werror=format=] 3176 | internal_error (__FILE__, __LINE__, _("VQ out of bounds: %ld (max %d)"), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../gdb/common/gdb_locale.h:28:29: note: in definition of macro '_' 28 | # define _(String) gettext (String) | ^~~~~~ ../../gdb/aarch64-tdep.c:3176:64: note: format string is defined here 3176 | internal_error (__FILE__, __LINE__, _("VQ out of bounds: %ld (max %d)"), | ~~^ | | | long int | %lld This happens because aarch64-tdep.c:aarch64_gdbarch_init prints a "uint64_t" variable using "%ld". This patch fixes the build by using "pulongest" instead. As explained in a similar fix (commit 495143533ad95369811391c6e3c6dadd69d7dd67), this should be safe because if aarch64-tdep.c is included in the build, then ULONGEST must be a 64-bit type. gdb/ChangeLog: 2019-04-24 Sergio Durigan Junior * aarch64-tdep.c (aarch64_gdbarch_init): Use "pulongest" to print "vq". --- gdb/ChangeLog | 5 +++++ gdb/aarch64-tdep.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 490c181762..21358ff311 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-04-24 Sergio Durigan Junior + + * aarch64-tdep.c (aarch64_gdbarch_init): Use "pulongest" to print + "vq". + 2019-04-24 Tom Tromey * amd64-tdep.c (amd64_has_unaligned_fields): Ignore bitfields. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index d53c57357f..f8b4fa4c97 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3173,8 +3173,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) vq = aarch64_get_tdesc_vq (info.target_desc); if (vq > AARCH64_MAX_SVE_VQ) - internal_error (__FILE__, __LINE__, _("VQ out of bounds: %ld (max %d)"), - vq, AARCH64_MAX_SVE_VQ); + internal_error (__FILE__, __LINE__, _("VQ out of bounds: %s (max %d)"), + pulongest (vq), AARCH64_MAX_SVE_VQ); /* If there is already a candidate, use it. */ for (gdbarch_list *best_arch = gdbarch_list_lookup_by_info (arches, &info);