From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 7A0723858407 for ; Sun, 21 Jan 2024 21:07:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A0723858407 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7A0723858407 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.83.234.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705871223; cv=none; b=uxrwWq3BbGwg/xtre7zWHQ0B5CLP9tgjmUHdLgvK4wVJZ4UeS4oTYk6QGlyfwmhpCDL0V6qWmWKOXjGbiG7a9VwuF2Q7BAQ6qVJ20Fn4XnaT/Gv+CW6DcXRhHuKbaL/1anTJdw5pHZx+alfYgbAGASU3XQtV/sHZ4YOz7bqVxjc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705871223; c=relaxed/simple; bh=ICcNfU9h+l6A55rr+xwcFz5gLu+5uBGgTZmfopUpkMY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=w/sSARMAjnI2ppBjj/zcFY7iT8QA1SWRvYoqCYCIOPQilRFVrg8xunUw4zC+ham/BePDnCw3Y4gbVlLkSnAGLH4q/k9NGqd33dLdOLW3xMpWI2RYJ82YqkJtlmwYUF96/F1vsd2OKp8wJPjalxpCH32Q46e1Ku7voonFjCOBEMw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from csb.redhat.com (deer0x03.wildebeest.org [172.31.17.133]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 63D84302BBEA; Sun, 21 Jan 2024 22:06:59 +0100 (CET) Received: by csb.redhat.com (Postfix, from userid 10916) id D99C4CEF2C; Sun, 21 Jan 2024 22:06:58 +0100 (CET) From: Mark Wielaard To: binutils@sourceware.org Cc: Mark Wielaard Subject: [PATCH] opcodes: tic4x_disassemble swap xcalloc arguments Date: Sun, 21 Jan 2024 22:01:42 +0100 Message-Id: <20240121210142.568900-1-mark@klomp.org> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: GCC 14 will detect when the size and count arguments of calloc are swapped. binutils-gdb/opcodes/tic4x-dis.c: In function ‘tic4x_disassemble’: binutils-gdb/opcodes/tic4x-dis.c:710:32: error: ‘xcalloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 710 | optab = xcalloc (sizeof (tic4x_inst_t *), (1 << TIC4X_HASH_SIZE)); | ^~~~~~~~~~~~ binutils-gdb/opcodes/tic4x-dis.c:710:32: note: earlier argument should specify number of elements, later size of each element binutils-gdb/opcodes/tic4x-dis.c:712:40: error: ‘xcalloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 712 | optab_special = xcalloc (sizeof (tic4x_inst_t *), TIC4X_SPESOP_SIZE); | ^~~~~~~~~~~~ binutils-gdb/opcodes/tic4x-dis.c:712:40: note: earlier argument should specify number of elements, later size of each element opcodes/ChangeLog: * /tic4x-dis.c (tic4x_disassemble): Swap size and count xcalloc arguments. --- opcodes/tic4x-dis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opcodes/tic4x-dis.c b/opcodes/tic4x-dis.c index 49de510981b..0c703ecf08a 100644 --- a/opcodes/tic4x-dis.c +++ b/opcodes/tic4x-dis.c @@ -707,9 +707,9 @@ tic4x_disassemble (unsigned long pc, if (optab == NULL) { - optab = xcalloc (sizeof (tic4x_inst_t *), (1 << TIC4X_HASH_SIZE)); + optab = xcalloc ((1 << TIC4X_HASH_SIZE), sizeof (tic4x_inst_t *)); - optab_special = xcalloc (sizeof (tic4x_inst_t *), TIC4X_SPESOP_SIZE); + optab_special = xcalloc (TIC4X_SPESOP_SIZE, sizeof (tic4x_inst_t *)); /* Install opcodes in reverse order so that preferred forms overwrite synonyms. */ -- 2.39.3