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);