From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B7AA3858C62; Fri, 2 Dec 2022 14:45:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B7AA3858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669992331; bh=kDXH8Bo6/qWdA14XDa417waQ4/OlO0AFnY6rMw7UhKA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IgxOCxWzkWUZoCEy2yu2DNAWEVMBkdJNKM/+Wh1G8uiS+u4zaO1LED5lMudDmpfDp RzGVOto23tN6uI4iVacq6yar1d5KPyHfM1MS0qCoQ+6CUT1+jPNcotr/Bslp9ZjREw eJcpGwfrDPX60dE1kmA5f3QtKdlTcfybceQ7NuV4= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107622] Missing optimization of switch-statement Date: Fri, 02 Dec 2022 14:45:31 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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 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=3D107622 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #10 from Jakub Jelinek --- If you use enum with fixed underlying type, then all the values of the underlying type are valid, even with -fstrict-enums. Otherwise namespace std { enum class byte : unsigned char {}; } couldn't work properly. Otherwise, with -fstrict-enums, enum { A, B, C } c= an have values 0, 1, 2, 3 and without -fstrict-enums all the values of the underlyi= ng type. See https://eel.is/c++draft/dcl.enum#8 for more details. So, except for the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107622#c4= g case where we should have optimized it into constant I don't see any missed optimizati= on here.=