From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 36E393858D28; Fri, 3 Nov 2023 08:25:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36E393858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698999931; bh=liDcQ/VC7cTh8qqCPLKDRoMuGfz8pv4gEOI1/I78aC8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XFL/QWrkU4RehuYlRSKZ4viDh/qQJv7voyYExOrryV9/Xz4Brb6M7j40c3bgz7Rnw j00sDM73vPUgsnnxcf6F1MZbYij0e3zzAi8P9Hiv88I3gpIHj8Trtf1sNFGkNw6sjD C3XbUPKHnVwVM/gpx+QaOpnjao6YoNx55xMFz/oA= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/112364] calloc used incorrectly Date: Fri, 03 Nov 2023 08:25:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: easyhack X-Bugzilla-Severity: normal X-Bugzilla-Who: xry111 at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cc bug_status keywords everconfirmed cf_reconfirmed_on Message-ID: In-Reply-To: References: 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 Xi Ruoyao changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xry111 at gcc dot gnu.org Status|UNCONFIRMED |NEW Keywords| |easyhack Ever confirmed|0 |1 Last reconfirmed| |2023-11-03 --- Comment #1 from Xi Ruoyao --- (In reply to Martin Uecker from comment #0) > 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 argume= nt. No, per the standard we can assign the result of calloc to T* iff T has a fundamental alignment requirement, i. e. _Alignof (max_align_t) >=3D _Align= of (T). It's not related to the specified size in calloc call. But anyway in this case the order of arguments is indeed wrong and it shoul= d be fixed.=