[Openmp-dev] Two warnings with clang 3.5 on ppc63le
Carlo Bertolli
cbertol at us.ibm.com
Fri Feb 27 14:57:18 PST 2015
Hi
Using clang 3.5 on ppc64le, I obtained the following warnings.
1.
/home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp_error.c:124:23:
warning: comparison of constant 16 with expression of type 'enum
cons_type' is always true [-Wtautological-constant-out-of-range-compare]
if ( 0 < ct && ct <= cons_text_c_num ) {;
~~ ^ ~~~~~~~~~~~~~~~
It looks like that there are no machines where const char * is more that
64-bit. The second check can be removed safely - maybe the author of this
intended something different?
2.
/home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp_runtime.c:270:58:
warning: multiple unsequenced modifications to 'gtid' [-Wunsequenced]
if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid =
__kmp_gtid_from_thread( th )))
^
/home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp.h:958:25:
note: expanded from macro 'KMP_UBER_GTID'
(__kmp_threads[(gtid)] == __kmp_root[(gtid)]->r.r_uber_thread)\
^
gtid here is modified multiple times. We can just move the assignment out
of the if and have only gtid as parameter of the macro.
Below a patch that fixes these problems. Please let me know your thoughts
on this.
Thanks
-- Carlo
diff --git a/runtime/src/kmp_error.c b/runtime/src/kmp_error.c
index b76c109..4274365 100644
--- a/runtime/src/kmp_error.c
+++ b/runtime/src/kmp_error.c
@@ -121,7 +121,7 @@ __kmp_pragma(
kmp_str_buf_t buffer;
kmp_msg_t prgm;
__kmp_str_buf_init( & buffer );
- if ( 0 < ct && ct <= cons_text_c_num ) {;
+ if ( 0 < ct ) {
cons = cons_text_c[ ct ];
} else {
KMP_DEBUG_ASSERT( 0 );
diff --git a/runtime/src/kmp_runtime.c b/runtime/src/kmp_runtime.c
index 55b58ce..0a08993 100644
--- a/runtime/src/kmp_runtime.c
+++ b/runtime/src/kmp_runtime.c
@@ -267,7 +267,8 @@ __kmp_check_stack_overlap( kmp_info_t *th )
}
/* No point in checking ubermaster threads since they use refinement
and cannot overlap */
- if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid =
__kmp_gtid_from_thread( th )))
+ gtid = __kmp_gtid_from_thread( th );
+ if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid))
{
KA_TRACE(10,("__kmp_check_stack_overlap: performing extensive
checking\n"));
if ( stack_beg == NULL ) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20150227/cbd7fe2f/attachment.html>
More information about the Openmp-dev
mailing list