From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9DB9D385C426; Fri, 17 Apr 2020 10:31:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DB9D385C426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587119485; bh=dbfSkn6AFZB6VvOSkc8tAUgfyVfy29OzVGuZGyc1V8w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GLDT9VhUMLOiiQ7gT26gGqTc4FRy5JqYU10z3Sbwj9vqX4qDbdkWhksTp55ejrZEK 3Sq1It5QyYIpD4PpLKE+1oIsnVKlAj3K+SzpRR7TPOEv7yelgct9NedmbmpZNAfjQx kjPNO/loiHC7qZ4Y94Ugus/QANZ4rKzYsTx39pfw= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/94629] 10 issues located by the PVS-studio static analyzer Date: Fri, 17 Apr 2020 10:31:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: 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: 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: Fri, 17 Apr 2020 10:31:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94629 --- Comment #9 from Jakub Jelinek --- Comment on attachment 48299 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48299 sorted list of redundant assignments /* If there were any declarations or structure tags in that level, or if this level is a function body, create a BLOCK to record them for the life of this function. */ block =3D NULL_TREE; /* Avoid function body block if possible. */ if (functionbody && subblocks && BLOCK_CHAIN (subblocks) =3D=3D NULL_TREE) keep =3D 0; else if (keep =3D=3D 1 || functionbody) block =3D make_node (BLOCK); if (block !=3D NULL_TREE) { BLOCK_VARS (block) =3D decls; BLOCK_SUBBLOCKS (block) =3D subblocks; } /* In each subblock, record that this is its superior. */ if (keep >=3D 0) for (link =3D subblocks; link; link =3D BLOCK_CHAIN (link)) BLOCK_SUPERCONTEXT (link) =3D block; certainly doesn't look like redundant assignment, yes, the block =3D NULL_T= REE could be moved into the if, but that is just programming style. I must say I don't understand why the separate if (block !=3D NULL_TREE) is= in there, perhaps from historic reasons there might have been more cases. Now it would make much more sense to just do else if (keep =3D=3D 1 || functionbody) { block =3D make_node (BLOCK); BLOCK_VARS (block) =3D decls; BLOCK_SUBBLOCKS (block) =3D subblocks; }=