public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/112364] New: calloc used incorrectly
@ 2023-11-03  7:53 muecker at gwdg dot de
  2023-11-03  8:25 ` [Bug libfortran/112364] " xry111 at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: muecker at gwdg dot de @ 2023-11-03  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112364
           Summary: calloc used incorrectly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

As detected by -Walloc-size, there are some calls to calloc in libgfortran with
incorrectly ordered arguments.

See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112347#c10


../../../trunk.year/libgfortran/io/async.c:265:24: warning: allocation of
insufficient size ‘1’ for type ‘transfer_queue’ with size ‘80’ [-Walloc-size]
../../../trunk.year/libgfortran/io/async.c:287:24: warning: allocation of
insufficient size ‘1’ for type ‘transfer_queue’ with size ‘80’ [-Walloc-size]
../../../trunk.year/libgfortran/io/async.c:311:24: warning: allocation of
insufficient size ‘1’ for type ‘transfer_queue’ with size ‘80’ [-Walloc-size]
../../../trunk.year/libgfortran/io/async.c:331:24: warning: allocation of
insufficient size ‘1’ for type ‘transfer_queue’ with size ‘80’ [-Walloc-size]

  transfer_queue *tq = calloc (sizeof (transfer_queue), 1);


Note that for the allocated size the order of arguments does not matter, but -
at least according to my understanding - the alignment requirements for the
returned memory may depend on the object size being the second argument.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-04-16 22:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03  7:53 [Bug libfortran/112364] New: calloc used incorrectly 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
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

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