public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/112364] calloc used incorrectly
Date: Fri, 03 Nov 2023 16:10:45 +0000	[thread overview]
Message-ID: <bug-112364-4-Wm5nNarH8L@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112364-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112364

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #8 from kargl at gcc dot gnu.org ---
7 comments?

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

  parent reply	other threads:[~2023-11-03 16:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03  7:53 [Bug libfortran/112364] New: " muecker at gwdg dot de
2023-11-03  8:25 ` [Bug libfortran/112364] " xry111 at gcc dot gnu.org
2023-11-03  9:04 ` muecker at gwdg dot de
2023-11-03  9:14 ` xry111 at gcc dot gnu.org
2023-11-03 10:06 ` muecker at gwdg dot de
2023-11-03 10:08 ` xry111 at gcc dot gnu.org
2023-11-03 12:11 ` muecker at gwdg dot de
2023-11-03 16:03 ` joseph at codesourcery dot com
2023-11-03 16:10 ` kargl at gcc dot gnu.org [this message]
2023-11-03 17:06 ` muecker at gwdg dot de
2023-11-03 17:16 ` joseph at codesourcery dot com
2023-11-03 17:23 ` kargl at gcc dot gnu.org
2023-11-03 17:27 ` muecker at gwdg dot de
2023-11-06 10:44 ` cvs-commit at gcc dot gnu.org
2023-11-06 10:58 ` burnus at gcc dot gnu.org
2024-04-16 22:19 ` peter0x44 at disroot dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112364-4-Wm5nNarH8L@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).