From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 85997385E004; Mon, 21 Mar 2022 18:49:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85997385E004 From: "segher at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104901] gcc/config/rs6000/mm_malloc.h:46: incorrectLogicOperator Date: Mon, 21 Mar 2022 18:49:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: segher at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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_status resolution 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2022 18:49:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104901 Segher Boessenkool changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #6 from Segher Boessenkool --- (In reply to pc from comment #5) > The code will use malloc if it can, and posix_memalign otherwise. If it knows it can based on some very simplistic criterion, yes. Is this a useful optimisation, or is this premature optimisation? > There may be a slight advantage to using malloc instead of posix_memalign. > The paths are indeed different. I'm not sure why the floor is raised after > determining not to call malloc: > -- > if (__alignment =3D=3D __malloc_align && __alignment =3D=3D __vec_align) > return malloc (__size); > if (__alignment < __vec_align) > __alignment =3D __vec_align; > -- If it does call malloc it *also* does this, it is just that __alignment already is the same then (and this function does an early out, too) ;-) > (I probably would've written the code slightly differently.) Yeah. > It appears to me that the identified code would be always false on a 32-b= it > system, where __malloc_align would be computed as 64 bits, and _vec_align= as > 128 bits. It would be always true on a 64-bit system (128 =3D=3D 128). Likely, yes. > All that being said, I'm not sure I see any problem with the code, and ma= ybe > the analyzer is being a bit overzealous? That's my point, yes. - * - Ah. This is some 3rd party checker. Closing as INVALID.=