From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2296E399C036; Wed, 28 Jul 2021 17:55:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2296E399C036 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/101645] warn about neg of unsigned type should be added to -Wsign-conversion Date: Wed, 28 Jul 2021 17:55:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: redi at gcc dot gnu.org 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: 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: Wed, 28 Jul 2021 17:55:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101645 --- Comment #5 from Jonathan Wakely --- (I wrote this before comment 4 was added ...) What would the precise semantics of the suggested warning be? What kind of expressions do you expect to warn, and which should not? How would I suppress the warning if -x is exactly what I intended to write = and it does exactly what I expect? For example, the implementation of std::align uses: inline void* align(size_t __align, size_t __size, void*& __ptr, size_t& __space) noexcept { if (__space < __size) return nullptr; const auto __intptr =3D reinterpret_cast(__ptr); const auto __aligned =3D (__intptr - 1u + __align) & -__align; // ... How would I prevent -__align from warning?=