From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1B91938582A1; Fri, 3 Nov 2023 07:53:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B91938582A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698998000; bh=ZThtPh00S7tyjoc+EsjFCsm2BJFpYt0rr5MKAMQc/wU=; h=From:To:Subject:Date:From; b=jLBEHMNCzkrfnTgl5M+8cFt0Xjnc98iaU0+Uoq1qi2H8KXDGnk9NV4T/yTCGmcJy+ 5qhKM+Hdr0wE89BhP+bUqUQFGp0zp1HDyHML7uHpJ3U0EP7KP6WPxB85NkBNa819To UtY/u4hzc0jcXe6vg7GGrDFsamTK6vwXL4DPslGk= From: "muecker at gwdg dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/112364] New: calloc used incorrectly Date: Fri, 03 Nov 2023 07:53:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: muecker at gwdg dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112364 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=3D112347#c10 ../../../trunk.year/libgfortran/io/async.c:265:24: warning: allocation of insufficient size =E2=80=981=E2=80=99 for type =E2=80=98transfer_queue=E2= =80=99 with size =E2=80=9880=E2=80=99 [-Walloc-size] ../../../trunk.year/libgfortran/io/async.c:287:24: warning: allocation of insufficient size =E2=80=981=E2=80=99 for type =E2=80=98transfer_queue=E2= =80=99 with size =E2=80=9880=E2=80=99 [-Walloc-size] ../../../trunk.year/libgfortran/io/async.c:311:24: warning: allocation of insufficient size =E2=80=981=E2=80=99 for type =E2=80=98transfer_queue=E2= =80=99 with size =E2=80=9880=E2=80=99 [-Walloc-size] ../../../trunk.year/libgfortran/io/async.c:331:24: warning: allocation of insufficient size =E2=80=981=E2=80=99 for type =E2=80=98transfer_queue=E2= =80=99 with size =E2=80=9880=E2=80=99 [-Walloc-size] transfer_queue *tq =3D calloc (sizeof (transfer_queue), 1); Note that for the allocated size the order of arguments does not matter, bu= t - at least according to my understanding - the alignment requirements for the returned memory may depend on the object size being the second argument.=