From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 10EEE3858403; Wed, 1 Dec 2021 01:26:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10EEE3858403 From: "stsp at users dot sourceforge.net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/103502] -Wstrict-aliasing=3 doesn't warn on what is documented as UB Date: Wed, 01 Dec 2021 01:26:37 +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: 11.2.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: stsp at users dot sourceforge.net 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: 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, 01 Dec 2021 01:26:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103502 --- Comment #7 from Stas Sergeev --- (In reply to Eric Gallager from comment #6) > -Wstrict-aliasing is kind of confusing in this regards since it's differe= nt > from how other warnings with numerical levels work. Normally a higher > numerical value to a warning option means "print more warnings" but for > -Wstrict-aliasing it means "try harder to reduce the number of warnings". Number of warnings, or number of false-positives? This is what is still unclear to me. If it reduces the number of warnings (including valid ones, by not applying some checks for example), then indeed what you propose can be done (or not done - it would be rather straight-forward anyway). But I had the following assumptions: 1. It reduces the number of only false-positives 2. It increases the amount of warnings by avoiding false-negatives (i.e. by not "hiding" the warnings that lower levels could miss) 3. The warning I've seen on lower levels was a valid one I suppose what you propose, can be done if 2 is not true. I still don't know which of the above wasn't true.=