From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7B9F7385C426; Fri, 17 Apr 2020 11:00:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B9F7385C426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587121241; bh=QoL5pHypxON6VpZi06O6wc5iVhKQmkH0WW95KKU3oDs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=D1apmnBmbpzF5YxqCp6AseYwv+ks4VhxemeOJJlBzk9ygq7BUcbSX+bslmwhza3c/ ZsUPzvQRd2tmyxOLU52UZ7PMCdv6sPsQgVrEXuWEgcYIlblr5LDWe/0cJqzkrotM4y 8USonAZEX1yN8yG5bFQbt2bqGUqF8zJD11IqhgYU= 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 11:00:40 +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: 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: Fri, 17 Apr 2020 11:00:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94629 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ams at gcc dot gnu.org --- Comment #10 from Jakub Jelinek --- I have a few unimportant tweaks for this in my tree. Anyway, e.g. in the GCN plugin, I wonder if we don't need: diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index dc72c90962c..c733b8bfb18 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -1508,7 +1508,8 @@ init_hsa_context (void) =3D GOMP_PLUGIN_malloc_cleared (hsa_context.agent_count * sizeof (struct agent_info)); status =3D hsa_fns.hsa_iterate_agents_fn (assign_agent_ids, &agent_index= ); - if (agent_index !=3D hsa_context.agent_count) + if (status !=3D HSA_STATUS_SUCCESS + || agent_index !=3D hsa_context.agent_count) { GOMP_PLUGIN_error ("Failed to assign IDs to all GCN agents"); return false; @@ -3473,7 +3474,8 @@ GOMP_OFFLOAD_init_device (int n) status =3D hsa_fns.hsa_agent_iterate_regions_fn (agent->id, get_kernarg_memory_region, &agent->kernarg_region); - if (agent->kernarg_region.handle =3D=3D (uint64_t) -1) + if (status !=3D HSA_STATUS_SUCCESS + || agent->kernarg_region.handle =3D=3D (uint64_t) -1) { GOMP_PLUGIN_error ("Could not find suitable memory region for kernel= " "arguments"); @@ -3486,7 +3488,8 @@ GOMP_OFFLOAD_init_device (int n) status =3D hsa_fns.hsa_agent_iterate_regions_fn (agent->id, get_data_memory_region, &agent->data_region); - if (agent->data_region.handle =3D=3D (uint64_t) -1) + if (status !=3D HSA_STATUS_SUCCESS + || agent->data_region.handle =3D=3D (uint64_t) -1) { GOMP_PLUGIN_error ("Could not find suitable memory region for device= " "data"); or if instead we should drop the "status =3D " for the cases where nothing = checks it. Andrew?=