From patchwork Mon Nov 6 10:53:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 161940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2572072vqu; Mon, 6 Nov 2023 02:53:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6sYrsDyKQyto6sAnwLH7kI6r+PoIH/Zw5DT4Il60DCtCqHIzi7zqlI9HqzF3Rha7vtjwy X-Received: by 2002:a05:6214:40c:b0:672:e2d5:7a7e with SMTP id z12-20020a056214040c00b00672e2d57a7emr26634289qvx.50.1699268036282; Mon, 06 Nov 2023 02:53:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699268036; cv=pass; d=google.com; s=arc-20160816; b=fcRYPE9xIQ9yro8UftTeTsiskLYKp9VhdWEAUY8u8Yt6u4VWB309y1jeBqwjjzOx5h 7O+7G5hy4roqAIKyl1Dl8azViEhBNTmnW9JF/YTN9wNNk9go0QegFtIS3EVJTFPT9qPq Y5Qq70Ziow2LUA2yweydDs/gUvmdNqvHYxiXwbyXkD4nv5t8nozbTaRbnxFtjAyGy9Lr GP9v2C0dg5Pyg6Worc1KPQdToozzuum0Li/46eQ7PskECbzlFDKWs1mRNE4WSbEFrcLa 2s8d+MIZm540bL6Q/34YUvOBL558HUXrLxzFsME2nTpR2sT6fh4oi/XOEtebI93Hmxz9 Is7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:to :content-language:user-agent:mime-version:date:message-id :ironport-sdr:arc-filter:dmarc-filter:delivered-to; bh=5/iMoMMtIc399IW3hi8cOkeAFyml1NHbg+C+Mi65bSk=; fh=ARF5Mvhgv4mOzEi1LJHgn82UOzar4LOruqM9inFDcVw=; b=bCyJyqxDP5XERtWidlAGxaypC1/UJzspu/q/cAKQRGJHUhCLq+dmYtIMYI6Gg1E8A8 Dx0V+IJ5bh+wOqwiU0fALIBAkTvT+NBcVYFsOo9mHw6cX0C/et7lUtKGavMfyvK20W66 8OnkOT2lV18zUJuoSqhlb39kHwPJ8RPPsGTXEfarqL7wQ/CQLUzIyxfYS7hGz4vulSML akAEsoH1L78RxlLc2gWXpVqmFuMs5dgZgnpHPOMRC6K/XK4PdyREJin4ScYMuk7tckjv Rg0UxkRTlKiFgPAiu3gfjCiXoH7agCUR2nADi2WwEyAfElX53wkPwcNkcQ8luA6kGlsz U/dw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bd19-20020ad45693000000b0066d23395d24si5283673qvb.360.2023.11.06.02.53.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 02:53:56 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 13D43385E01F for ; Mon, 6 Nov 2023 10:53:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 272573858401; Mon, 6 Nov 2023 10:53:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 272573858401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 272573858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.180 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699268012; cv=none; b=bPS+tpq34ZjfTUlUhilnFMvOtLLkrAA/MJ7N0v4rLLrO5Q9ZEgAjmLBK85UQL6ZvdQ06tTcof7W4YDPwTvekMpCNsUA5sstUkVKwGLm0Ng1o8R19yJF3qgYADRu5YSKGUgS3hR2VlptQ5UclhJMtI9EkYnE8L0YankBJ1QXhz+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699268012; c=relaxed/simple; bh=5/iMoMMtIc399IW3hi8cOkeAFyml1NHbg+C+Mi65bSk=; h=Message-ID:Date:MIME-Version:To:From:Subject; b=w8mk5+UhNQ+raL7S21Nh9gJIVWkgM/JPaYPdj1aIBfcjLvVsLolJ6PRzF+JqrXjtayJM49/dbZ/a6K4+t98vOZn/ZqApc+pnRDK7SlDyC71K4lbGWE5RQKhFXP3U2Um2vRF77lE81H82souCiybYLy+AAPbyt0lnGcUCRuE4c1w= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: /cVRcxNdTeKRUOGKEaqPag== X-CSE-MsgGUID: 1+K3EhoVQRKYVsrf1K93Gg== X-IronPort-AV: E=Sophos;i="6.03,281,1694764800"; d="diff'?scan'208";a="22027260" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 06 Nov 2023 02:53:26 -0800 IronPort-SDR: UbVFbYBkdoGmR6fPMc4SHpJ6/E8yrOaFhbk53TXa552TN3kjFn61dosSW1Ts8Xpa27KfRakQUX 5oDUdjoDsDFZTF84oXSsYrKZrFwpqGN3uzFznLbmr6oEFV2WKpMi2tKdwCpmWJv5Sb/MSDZerJ 0Muvs9JvTVuBAIXX4myM997Z9NY4+2yUeQpxCKkOmd+n6rwDTq+FToltZLrql50Gyvqwv+TTrd mbPBaebe9MuuE6GPpe2FH7r2IjeIErQ6ndnBpKwqxeIDfn0M8WVJGVeAFsqVv5GGcboRLHiL8y 3kk= Message-ID: <3ff033dd-0187-48bb-ba7c-797232cb6000@codesourcery.com> Date: Mon, 6 Nov 2023 11:53:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches , fortran From: Tobias Burnus Subject: [committed] libgfortran: Fix calloc call by swapping arg order [PR112364] X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781811680522514282 X-GMAIL-MSGID: 1781811680522514282 See PR for a discussion whether this change is required for alignment (or other) reasons (looks as if not) - or"just" to match the indented order (arg names + description) and to silence a -Walloc-size warning. Committed as r14-5148-g17df6ddcf11aef (BTW: I don't think that it is worthwhile to backport it - the -Walloc-size warning is new since r14-5059-gd880e093d92084.) Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 commit 17df6ddcf11aef6d200305d35641a7deb2f430e1 Author: Tobias Burnus Date: Mon Nov 6 11:34:31 2023 +0100 libgfortran: Fix calloc call by swapping arg order [PR112364] The prototype of calloc is void *calloc(size_t nmemb, size_t size); denoting "an array of nmemb objects, each of whose size is size." (C23) In order to follow the meaning of the argument names and to silence a -Walloc-size warning, this commit swaps the order of the two args to read now: calloc (1, sizeof (transfer_queue)); libgfortran/ChangeLog: PR libfortran/112364 * io/async.c (enqueue_transfer, enqueue_done_id, enqueue_done, enqueue_close): Swap 1st and 2nd arg in calloc call. diff --git a/libgfortran/io/async.c b/libgfortran/io/async.c index 57097438e89..8fa1f0d4ce0 100644 --- a/libgfortran/io/async.c +++ b/libgfortran/io/async.c @@ -262,7 +262,7 @@ init_async_unit (gfc_unit *u) void enqueue_transfer (async_unit *au, transfer_args *arg, enum aio_do type) { - transfer_queue *tq = calloc (sizeof (transfer_queue), 1); + transfer_queue *tq = calloc (1, sizeof (transfer_queue)); tq->arg = *arg; tq->type = type; tq->has_id = 0; @@ -284,7 +284,7 @@ int enqueue_done_id (async_unit *au, enum aio_do type) { int ret; - transfer_queue *tq = calloc (sizeof (transfer_queue), 1); + transfer_queue *tq = calloc (1, sizeof (transfer_queue)); tq->type = type; tq->has_id = 1; @@ -308,7 +308,7 @@ enqueue_done_id (async_unit *au, enum aio_do type) void enqueue_done (async_unit *au, enum aio_do type) { - transfer_queue *tq = calloc (sizeof (transfer_queue), 1); + transfer_queue *tq = calloc (1, sizeof (transfer_queue)); tq->type = type; tq->has_id = 0; LOCK (&au->lock); @@ -328,7 +328,7 @@ enqueue_done (async_unit *au, enum aio_do type) void enqueue_close (async_unit *au) { - transfer_queue *tq = calloc (sizeof (transfer_queue), 1); + transfer_queue *tq = calloc (1, sizeof (transfer_queue)); tq->type = AIO_CLOSE; LOCK (&au->lock);