From patchwork Sun Jun 18 21:18:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 21070 Received: (qmail 20649 invoked by alias); 18 Jun 2017 21:18:20 -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 20633 invoked by uid 89); 18 Jun 2017 21:18:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*MI:free, HX-Envelope-From:sk:thomas. X-HELO: mail.free-electrons.com Received: from mail.free-electrons.com (HELO mail.free-electrons.com) (62.4.15.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 18 Jun 2017 21:18:18 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id BD06921DE1; Sun, 18 Jun 2017 23:18:20 +0200 (CEST) Received: from localhost (LFbn-1-6691-76.w90-120.abo.wanadoo.fr [90.120.129.76]) by mail.free-electrons.com (Postfix) with ESMTPSA id 9960E21DA4; Sun, 18 Jun 2017 23:18:20 +0200 (CEST) From: Thomas Petazzoni To: gdb-patches@sourceware.org Cc: Thomas Petazzoni Subject: [PATCH] nat/linux-ptrace.c: add missing gdb_byte* cast Date: Sun, 18 Jun 2017 23:18:19 +0200 Message-Id: <20170618211819.29614-1-thomas.petazzoni@free-electrons.com> On noMMU platforms, the following code gets compiled: child_stack = xmalloc (STACK_SIZE * 4); Where child_stack is a gdb_byte*, and xmalloc() returns a void*. While the lack of cast is valid in C, it is not in C++, causing the following build failure: ../nat/linux-ptrace.c: In function 'int linux_fork_to_function(gdb_byte*, int (*)(void*))': ../nat/linux-ptrace.c:273:29: error: invalid conversion from 'void*' to 'gdb_byte* {aka unsigned char*}' [-fpermissive] child_stack = xmalloc (STACK_SIZE * 4); Therefore, this commit adds the appropriate cast. gdb/ChangeLog: * nat/linux-ptrace.c (linux_fork_to_function): fix cast to gdb_byte*, needed for C++ build. Signed-off-by: Thomas Petazzoni --- gdb/nat/linux-ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c index 3265b16..5d38a66 100644 --- a/gdb/nat/linux-ptrace.c +++ b/gdb/nat/linux-ptrace.c @@ -272,7 +272,7 @@ linux_fork_to_function (gdb_byte *child_stack, int (*function) (void *)) #define STACK_SIZE 4096 if (child_stack == NULL) - child_stack = xmalloc (STACK_SIZE * 4); + child_stack = (gdb_byte*) xmalloc (STACK_SIZE * 4); /* Use CLONE_VM instead of fork, to support uClinux (no MMU). */ #ifdef __ia64__