From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id 17B9F3858D1E; Tue, 13 Sep 2022 17:11:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17B9F3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663089083; bh=op5Yy3Ws9z1u965CicLsWe9hO+E50tHWo5WCFlvbjCA=; h=From:To:Subject:Date:From; b=wYzefHPmQ4F8YkPPB0MVcagQIq8m1IlXkbvE6iF75i+moYXNRAigCYmbY9VmnNkB0 RvJkLEGaVR0h+gUs0yhEPLRzQDzlNyTiBWH3LqphR6Hvs2m/2ripJrthqEbnrT0SBS P6TF0ZKIprDPztS6Px4GMo6dIx7deSFXKZeypKcY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] libgomp: Appease some static analyzers [PR106906] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: 82bfbdca15292ca2ca614c7ec16b8fe10124ddd4 X-Git-Newrev: ccd3d15a5c27ecbfc5b244eeee30a5846fa0f979 Message-Id: <20220913171123.17B9F3858D1E@sourceware.org> Date: Tue, 13 Sep 2022 17:11:23 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ccd3d15a5c27ecbfc5b244eeee30a5846fa0f979 commit ccd3d15a5c27ecbfc5b244eeee30a5846fa0f979 Author: Jakub Jelinek Date: Tue Sep 13 19:11:04 2022 +0200 libgomp: Appease some static analyzers [PR106906] While icv_addr[1] = false; assignments where icv_addr has void * element type is correct and matches how it is used (in those cases the void * pointer is then cast to bool and used that way), there is no reason not to add explicit (void *) casts there which are there already for (void *) true. And, there is in fact even no point in actually doing those stores at all because we set that pointer to NULL a few lines earlier. So, this patch adds the explicit casts and then comments those out to show intent. 2022-09-13 Jakub Jelinek PR libgomp/106906 * env.c (get_icv_member_addr): Cast false to void * before assigning it to icv_addr[1], and comment the whole assignment out. (cherry picked from commit e11babbfac21163118b69dd25b468ade80dbe8de) Diff: --- libgomp/ChangeLog.omp | 9 +++++++++ libgomp/env.c | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index 7890b058f89..20cc22d8434 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,12 @@ +2022-09-13 Tobias Burnus + + Backport from mainline: + 2022-09-13 Jakub Jelinek + + PR libgomp/106906 + * env.c (get_icv_member_addr): Cast false to void * before assigning + it to icv_addr[1], and comment the whole assignment out. + 2022-09-13 Tobias Burnus Backport from mainline: diff --git a/libgomp/env.c b/libgomp/env.c index ac8c764db60..0249966e8a6 100644 --- a/libgomp/env.c +++ b/libgomp/env.c @@ -1892,14 +1892,14 @@ get_icv_member_addr (struct gomp_initial_icvs *icvs, int icv_code, { case GOMP_ICV_NTEAMS: icv_addr[0] = &icvs->nteams_var; - icv_addr[1] = false; + /* icv_addr[1] = (void *) false; */ break; case GOMP_ICV_DYNAMIC: icv_addr[0] = &(*icvs).dyn_var; break; case GOMP_ICV_TEAMS_THREAD_LIMIT: icv_addr[0] = &icvs->teams_thread_limit_var; - icv_addr[1] = false; + /* icv_addr[1] = (void *) false; */ break; case GOMP_ICV_SCHEDULE: icv_addr[0] = &icvs->run_sched_var; @@ -1907,7 +1907,7 @@ get_icv_member_addr (struct gomp_initial_icvs *icvs, int icv_code, break; case GOMP_ICV_THREAD_LIMIT: icv_addr[0] = &icvs->thread_limit_var; - icv_addr[1] = false; + /* icv_addr[1] = (void *) false; */ icv_addr[2] = (void *) UINT_MAX; break; case GOMP_ICV_NTHREADS: