From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5828E385800D; Wed, 5 Jan 2022 13:55:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5828E385800D From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103899] [12 Regression] make profiledbootstrap fails due to uninitialized warning in expr.c Date: Wed, 05 Jan 2022 13:55:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: build, diagnostic, 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: 12.0 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 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, 05 Jan 2022 13:55:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103899 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek --- While we should fix uninit warning to deal with this if possible, I think we should also try to work around this in expr.c. If following works, then I think it would be even a cleanup (as it moves the context variable declaration to the sole spot where it is used): --- gcc/expr.c.jj 2022-01-03 10:40:41.203164211 +0100 +++ gcc/expr.c 2022-01-05 14:47:47.684660031 +0100 @@ -10340,7 +10340,6 @@ expand_expr_real_1 (tree exp, rtx target enum tree_code code =3D TREE_CODE (exp); rtx subtarget, original_target; int ignore; - tree context; bool reduce_bit_field; location_t loc =3D EXPR_LOCATION (exp); struct separate_ops ops; @@ -10579,14 +10578,16 @@ expand_expr_real_1 (tree exp, rtx target /* Variables inherited from containing functions should have been lowered by this point. */ if (exp) - context =3D decl_function_context (exp); - gcc_assert (!exp - || SCOPE_FILE_SCOPE_P (context) - || context =3D=3D current_function_decl - || TREE_STATIC (exp) - || DECL_EXTERNAL (exp) - /* ??? C++ creates functions that are not TREE_STATIC. */ - || TREE_CODE (exp) =3D=3D FUNCTION_DECL); + { + tree context =3D decl_function_context (exp); + gcc_assert (SCOPE_FILE_SCOPE_P (context) + || context =3D=3D current_function_decl + || TREE_STATIC (exp) + || DECL_EXTERNAL (exp) + /* ??? C++ creates functions that are not + TREE_STATIC. */ + || TREE_CODE (exp) =3D=3D FUNCTION_DECL); + } /* This is the case of an array whose size is to be determined from its initializer, while the initializer is still being parsed.=