<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Lucida Console";
        panose-1:2 11 6 9 4 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Verdana",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">1.</span><br>
</a><span style="font-size:10.0pt;font-family:"Arial",sans-serif">/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]</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">    if ( 0 < ct && ct <= cons_text_c_num ) {;</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">                   ~~ ^  ~~~~~~~~~~~~~~~</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">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?</span><br>
<br>
<span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">I think you’re misunderstanding the point here. cons_text_c_num gives us the number of elements in the table. The point so to ensure that the value we’ve been passed
 is a correct index into the table. The compiler is right that *<b>if</b>* the value passed is a correct member of the enumeration it can’t be outside the range, but the check is there precisely to ensure that the value passed in is in range (because we can’t
 tell here that someone didn’t call this with “(enum cons_type)1000”).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">So I think what we need here is a cast so that your compiler is happy, rather than removing the test.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">Something like<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">   
</span><span style="font-size:10.0pt;font-family:"Lucida Console""> if ( 0 < ct && ((int)ct) <= cons_text_c_num ) {;</span><span style="font-family:"Lucida Console""><br>
<br>
</span><span lang="EN-GB" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">You could write the whole thing as<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Lucida Console"">    if ( ((unsigned int)ct) <= cons_text_c_num ) {;</span><br>
<span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">but that may be a little too clever for its own good, especially since the performance of this code can’t matter.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">-- Jim<br>
<br>
James Cownie <james.h.cownie@intel.com><br>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">Tel: +44 117 9071438</span><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> openmp-dev-bounces@cs.uiuc.edu [mailto:openmp-dev-bounces@cs.uiuc.edu]
<b>On Behalf Of </b>Carlo Bertolli<br>
<b>Sent:</b> Friday, February 27, 2015 10:57 PM<br>
<b>To:</b> openmp-dev@dcs-maillist2.engr.illinois.edu<br>
<b>Subject:</b> [Openmp-dev] Two warnings with clang 3.5 on ppc63le<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Hi</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">Using clang 3.5 on ppc64le, I obtained the following warnings.</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">1.</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">/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]</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">    if ( 0 < ct && ct <= cons_text_c_num ) {;</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">                   ~~ ^  ~~~~~~~~~~~~~~~</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">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?</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">2.</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">/home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp_runtime.c:270:58: warning: multiple unsequenced modifications to 'gtid' [-Wunsequenced]</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">    if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid = __kmp_gtid_from_thread( th )))</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">                                                         ^</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">/home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp.h:958:25: note: expanded from macro 'KMP_UBER_GTID'</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">        (__kmp_threads[(gtid)] == __kmp_root[(gtid)]->r.r_uber_thread)\</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">                        ^</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">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.</span><br>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">Below a patch that fixes these problems. Please let me know your thoughts on this.</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">Thanks</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">-- Carlo</span><br>
<br>
<br>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">diff --git a/runtime/src/kmp_error.c b/runtime/src/kmp_error.c</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">index b76c109..4274365 100644</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">--- a/runtime/src/kmp_error.c</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">+++ b/runtime/src/kmp_error.c</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">@@ -121,7 +121,7 @@ __kmp_pragma(</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">     kmp_str_buf_t buffer;</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">     kmp_msg_t     prgm;</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">     __kmp_str_buf_init( & buffer );</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">-    if ( 0 < ct && ct <= cons_text_c_num ) {;</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">+    if ( 0 < ct ) {</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">         cons = cons_text_c[ ct ];</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">     } else {</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">         KMP_DEBUG_ASSERT( 0 );</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">diff --git a/runtime/src/kmp_runtime.c b/runtime/src/kmp_runtime.c</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">index 55b58ce..0a08993 100644</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">--- a/runtime/src/kmp_runtime.c</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">+++ b/runtime/src/kmp_runtime.c</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">@@ -267,7 +267,8 @@ __kmp_check_stack_overlap( kmp_info_t *th )</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">     }</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">     /* No point in checking ubermaster threads since they use refinement and cannot overlap */</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">-    if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid = __kmp_gtid_from_thread( th )))</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">+    gtid = __kmp_gtid_from_thread( th );</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">+    if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid))</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">     {</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">         KA_TRACE(10,("__kmp_check_stack_overlap: performing extensive checking\n"));</span><br>
<span style="font-size:10.0pt;font-family:"Arial",sans-serif">         if ( stack_beg == NULL ) {</span><o:p></o:p></p>
</div>
<p>---------------------------------------------------------------------<br>
Intel Corporation (UK) Limited<br>
Registered No. 1134945 (England)<br>
Registered Office: Pipers Way, Swindon SN3 1RJ<br>
VAT No: 860 2173 47</p>

<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></body>
</html>