]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: Appease some static analyzers [PR106906]
authorJakub Jelinek <jakub@redhat.com>
Tue, 13 Sep 2022 17:11:04 +0000 (19:11 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 13 Sep 2022 17:11:04 +0000 (19:11 +0200)
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  <jakub@redhat.com>

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)

libgomp/ChangeLog.omp
libgomp/env.c

index 7890b058f89be9c67f0b20dc360d937341fed2a9..20cc22d8434c8ffee1b7d7b1bbeb4116685f5c54 100644 (file)
@@ -1,3 +1,12 @@
+2022-09-13  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backport from mainline:
+       2022-09-13  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <tobias@codesourcery.com>
 
        Backport from mainline:
index ac8c764db6029ec877bb34c5abba2239e6977284..0249966e8a6fbe09ce1631eba7c2ecc1e8fb210b 100644 (file)
@@ -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: