<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:0in;
        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:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle19
        {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:8.5in 11.0in;
        margin:56.7pt 42.5pt 56.7pt 85.05pt;}
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="RU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Hi Carlo,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D;mso-fareast-language:EN-US">The patch looks good to me.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D;mso-fareast-language:EN-US">I have committed it, svn rev. 231078.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D;mso-fareast-language:EN-US">Andrey<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span lang="EN-US" 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> Monday, March 02, 2015 7:41 PM<br>
<b>To:</b> Cownie, James H<br>
<b>Cc:</b> openmp-dev@dcs-maillist2.engr.illinois.edu<br>
<b>Subject:</b> Re: [Openmp-dev] Two warnings with clang 3.5 on ppc63le<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">Hi</span><span lang="EN-US"><br>
<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">This worked well. Below a new version of the patch with this new modification.</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">Do you have any other objections to this?</span><span lang="EN-US"><br>
<br>
<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">Thanks!</span><span lang="EN-US"><br>
<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">-- Carlo</span><span lang="EN-US"><br>
<br>
</span><span lang="EN-US" 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><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">index b76c109..825157a 100644</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">--- a/runtime/src/kmp_error.c</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">+++ b/runtime/src/kmp_error.c</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">@@ -111,7 +111,7 @@ __kmp_expand_cons_stack( int gtid, struct cons_header *p )</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""> // NOTE: Function returns allocated memory, caller must free it!</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""> static char const *</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""> __kmp_pragma(</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">-    enum cons_type   ct,</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">+    int              ct,</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     ident_t const *  ident</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""> ) {</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     char const * cons = NULL;  // Construct name.</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">@@ -121,7 +121,7 @@ __kmp_pragma(</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     kmp_str_buf_t buffer;</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     kmp_msg_t     prgm;</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     __kmp_str_buf_init( & buffer );</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">-    if ( 0 < ct && ct <= cons_text_c_num ) {;</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">+    if ( 0 < ct && ct <= cons_text_c_num ) {</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">         cons = cons_text_c[ ct ];</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     } else {</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">         KMP_DEBUG_ASSERT( 0 );</span><span lang="EN-US"><br>
</span><span lang="EN-US" 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><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">index 55b58ce..0a08993 100644</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">--- a/runtime/src/kmp_runtime.c</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">+++ b/runtime/src/kmp_runtime.c</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">@@ -267,7 +267,8 @@ __kmp_check_stack_overlap( kmp_info_t *th )</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     }</span><span lang="EN-US"><br>
<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     /* No point in checking ubermaster threads since they use refinement and cannot overlap */</span><span lang="EN-US"><br>
</span><span lang="EN-US" 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><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">+    gtid = __kmp_gtid_from_thread( th );</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">+    if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid))</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">     {</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">         KA_TRACE(10,("__kmp_check_stack_overlap: performing extensive checking\n"));</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">         if ( stack_beg == NULL ) {</span><span lang="EN-US"><br>
<br>
<br>
<br>
</span><img width="20" height="20" id="Picture_x0020_1" src="cid:image002.png@01D055E7.92B3FD20" alt="Inactive hide details for "Cownie, James H" ---03/02/2015 11:27:36 AM---I do understand the casting solution, but I am not sure"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#424282">"Cownie,
 James H" ---03/02/2015 11:27:36 AM---I do understand the casting solution, but I am not sure what function you are referring to in your l</span><span lang="EN-US"><br>
<br>
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">From:
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">"Cownie, James H" <</span><a href="mailto:james.h.cownie@intel.com"><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">james.h.cownie@intel.com</span></a><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">></span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">To:
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">Carlo Bertolli/Watson/IBM@IBMUS</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">Cc:
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">Hal Finkel <</span><a href="mailto:hfinkel@anl.gov"><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">hfinkel@anl.gov</span></a><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">>,
 "</span><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">"
 <</span><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">></span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">Date:
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">03/02/2015 11:27 AM</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">Subject:
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">RE: [Openmp-dev] Two warnings with clang 3.5 on ppc63le</span><span lang="EN-US"><o:p></o:p></span></p>
<div>
<div class="MsoNormal">
<hr size="2" width="100%" noshade="" style="color:#8091A5" align="left">
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><br>
<br>
<br>
</span><a name="_MailEndCompose"></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">I do understand the casting solution, but I am not sure what function you are referring to in your last message.<br>
Can you please explain?</span><span lang="EN-US"><br>
<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D">My proposal would be to change the interface to
</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D"> </span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">static char const *</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">__kmp_pragma(</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">    enum cons_type   ct,</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">    ident_t const *  ident</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">)
</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D"> </span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D">Which is the function in question, I believe, to be
</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D"> </span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">static char const *</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">__kmp_pragma(</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">    int              ct,</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">    ident_t const *  ident</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">)
</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D"> </span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D">At the call site, this should still be OK, because (IIRC) C allows a silent case from an enum to an int, the hope, then, is that since inside this function the
 compiler only knows that ct is an integer it won’t believe that its range is restricted, and therefore that the test is unnecessary. Of course, the compiler may still try to be cleverer than that, and to inline the function, in which case it will notice that
 the only arguments passed are of type </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#1F497D">enum cons_type</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D"> in which
 case we’ll be back where we started :-(.</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D"> </span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D">The real issue here is that we’re trying to be very conservative in this code because we’re dealing with error messages so we know something is wrong and that
 might have been caused by random stores from buggy user code which could have corrupted the place we’re reading the enumeration from, but the compiler is working on the basis of optimizing correct code…</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D"> </span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D">-- Jim<br>
<br>
James Cownie <</span><a href="mailto:james.h.cownie@intel.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif"">james.h.cownie@intel.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D">><br>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D">Tel: +44 117 9071438</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D"> </span><span lang="EN-US"><br>
</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif""> Carlo Bertolli [</span><a href="mailto:cbertol@us.ibm.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif"">mailto:cbertol@us.ibm.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif"">]
<b><br>
Sent:</b> Monday, March 2, 2015 4:16 PM<b><br>
To:</b> Cownie, James H<b><br>
Cc:</b> Hal Finkel; </span><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif"">openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif""><br>
Subject:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif""> RE: [Openmp-dev] Two warnings with clang 3.5 on ppc63le</span><span lang="EN-US"><br>
  <o:p></o:p></span></p>
<p><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif"">Hi Jim, Hal,</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><br>
Thanks for explaining this.</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><br>
I do understand the casting solution, but I am not sure what function you are referring to in your last message.<br>
Can you please explain?</span><span lang="EN-US"><br>
<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><br>
Thanks</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""><br>
-- Carlo</span><span lang="EN-US"><br>
<br>
<br>
<br>
</span><img border="0" width="20" height="20" id="Picture_x0020_3" src="cid:image002.png@01D055E7.92B3FD20" alt="Inactive hide details for "Cownie, James H" ---03/02/2015 06:28:19 AM---> If you'd like to prevent this, you'll need to change "><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#424282">"Cownie,
 James H" ---03/02/2015 06:28:19 AM---> If you'd like to prevent this, you'll need to change the type of the variable to int  > (or unsign</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F"><br>
From: </span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">"Cownie, James H" <</span><a href="mailto:james.h.cownie@intel.com"><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">james.h.cownie@intel.com</span></a><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">><span style="color:#5F5F5F"><br>
To: </span>Hal Finkel <</span><a href="mailto:hfinkel@anl.gov"><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">hfinkel@anl.gov</span></a><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">><span style="color:#5F5F5F"><br>
Cc: </span>Carlo Bertolli/Watson/IBM@IBMUS, "</span><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">"
 <</span><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif"">><span style="color:#5F5F5F"><br>
Date: </span>03/02/2015 06:28 AM<span style="color:#5F5F5F"><br>
Subject: </span>RE: [Openmp-dev] Two warnings with clang 3.5 on ppc63le</span><span lang="EN-US"><o:p></o:p></span></p>
<div>
<div class="MsoNormal">
<hr size="2" width="100%" noshade="" style="color:#A0A0A0" align="left">
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><br>
<br>
<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><br>
> If you'd like to prevent this, you'll need to change the type of the variable to int
<br>
> (or unsigned int, etc.). You might notice that in LLVM, for example, we have many 'enum'
<br>
> variables that are typed as 'int' or 'unsigned' for a similar reason (if you want to use
<br>
> an enum to name some possible integer values, but allow others, you can't actually use an
<br>
> enum as the variable type).<br>
<br>
So the right answer, then, would be to change the formal argument of the function to be of
<br>
type "int", rather than the enum type, and rely on the fact that enums are silently, automatically, cast<br>
to int.<br>
<br>
-- Jim<br>
<br>
James Cownie <</span><a href="mailto:james.h.cownie@intel.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">james.h.cownie@intel.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">><br>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)<br>
Tel: +44 117 9071438<br>
<br>
-----Original Message-----<br>
From: Hal Finkel [</span><a href="mailto:hfinkel@anl.gov"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">mailto:hfinkel@anl.gov</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">]
<br>
Sent: Monday, March 2, 2015 11:15 AM<br>
To: Cownie, James H<br>
Cc: Carlo Bertolli; </span><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><br>
Subject: Re: [Openmp-dev] Two warnings with clang 3.5 on ppc63le<br>
<br>
----- Original Message -----<br>
> From: "James H Cownie" <</span><a href="mailto:james.h.cownie@intel.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">james.h.cownie@intel.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">><br>
> To: "Carlo Bertolli" <</span><a href="mailto:cbertol@us.ibm.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">cbertol@us.ibm.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">>,
</span><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><br>
> Sent: Monday, March 2, 2015 4:28:27 AM<br>
> Subject: Re: [Openmp-dev] Two warnings with clang 3.5 on ppc63le<br>
> <br>
> 1.<br>
> /home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp_error.c:124:23:<br>
> warning: comparison of constant 16 with expression of type 'enum<br>
> cons_type' is always true<br>
> [-Wtautological-constant-out-of-range-compare]<br>
> if ( 0 < ct && ct <= cons_text_c_num ) {;<br>
> ~~ ^ ~~~~~~~~~~~~~~~<br>
> <br>
> It looks like that there are no machines where const char * is more<br>
> that 64-bit. The second check can be removed safely - maybe the<br>
> author of this intended something different?<br>
> <br>
> I think you’re misunderstanding the point here. cons_text_c_num gives<br>
> us the number of elements in the table. The point so to ensure that<br>
> the value we’ve been passed is a correct index into the table. The<br>
> compiler is right that * if * the value passed is a correct member<br>
> of the enumeration it can’t be outside the range, but the check is<br>
> there precisely to ensure that the value passed in is in range<br>
> (because we can’t tell here that someone didn’t call this with<br>
> “(enum cons_type)1000”).<br>
> <br>
> So I think what we need here is a cast so that your compiler is<br>
> happy<br>
<br>
To be clear, the problem with the happiness of the compiler here is that, as written, the compiler is free to remove the check all together. Adding the cast may silence the warning, but the compiler's optimizer is still free to infer the range of the variable
 based on its original type. If you'd like to prevent this, you'll need to change the type of the variable to int (or unsigned int, etc.). You might notice that in LLVM, for example, we have many 'enum' variables that are typed as 'int' or 'unsigned' for a
 similar reason (if you want to use an enum to name some possible integer values, but allow others, you can't actually use an enum as the variable type).<br>
<br>
-Hal<br>
<br>
>, rather than removing the test.<br>
> <br>
> Something like<br>
> <br>
> if ( 0 < ct && ((int)ct) <= cons_text_c_num ) {;<br>
> <br>
> You could write the whole thing as<br>
> <br>
> if ( ((unsigned int)ct) <= cons_text_c_num ) {;<br>
> but that may be a little too clever for its own good, especially<br>
> since the performance of this code can’t matter.<br>
> <br>
> -- Jim<br>
> <br>
> James Cownie <</span><a href="mailto:james.h.cownie@intel.com"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">james.h.cownie@intel.com</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">><br>
> SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)<br>
> <br>
> Tel: +44 117 9071438<br>
> <br>
> <br>
> <br>
> <br>
> <br>
> From: </span><a href="mailto:openmp-dev-bounces@cs.uiuc.edu"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">openmp-dev-bounces@cs.uiuc.edu</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><br>
> [</span><a href="mailto:openmp-dev-bounces@cs.uiuc.edu"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">mailto:openmp-dev-bounces@cs.uiuc.edu</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">] On Behalf
 Of Carlo Bertolli<br>
> Sent: Friday, February 27, 2015 10:57 PM<br>
> To: </span><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><br>
> Subject: [Openmp-dev] Two warnings with clang 3.5 on ppc63le<br>
> <br>
> <br>
> <br>
> Hi<br>
> <br>
> Using clang 3.5 on ppc64le, I obtained the following warnings.<br>
> <br>
> 1.<br>
> /home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp_error.c:124:23:<br>
> warning: comparison of constant 16 with expression of type 'enum<br>
> cons_type' is always true<br>
> [-Wtautological-constant-out-of-range-compare]<br>
> if ( 0 < ct && ct <= cons_text_c_num ) {;<br>
> ~~ ^ ~~~~~~~~~~~~~~~<br>
> <br>
> It looks like that there are no machines where const char * is more<br>
> that 64-bit. The second check can be removed safely - maybe the<br>
> author of this intended something different?<br>
> <br>
> 2.<br>
> /home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp_runtime.c:270:58:<br>
> warning: multiple unsequenced modifications to 'gtid'<br>
> [-Wunsequenced]<br>
> if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid =<br>
> __kmp_gtid_from_thread( th )))<br>
> ^<br>
> /home/compteam/slave0/build_folder_omp/libiomp-src/runtime/src/kmp.h:958:25:<br>
> note: expanded from macro 'KMP_UBER_GTID'<br>
> (__kmp_threads[(gtid)] == __kmp_root[(gtid)]->r.r_uber_thread)\<br>
> ^<br>
> <br>
> gtid here is modified multiple times. We can just move the assignment<br>
> out of the if and have only gtid as parameter of the macro.<br>
> <br>
> <br>
> Below a patch that fixes these problems. Please let me know your<br>
> thoughts on this.<br>
> <br>
> Thanks<br>
> <br>
> -- Carlo<br>
> <br>
> <br>
> <br>
> <br>
> diff --git a/runtime/src/kmp_error.c b/runtime/src/kmp_error.c<br>
> index b76c109..4274365 100644<br>
> --- a/runtime/src/kmp_error.c<br>
> +++ b/runtime/src/kmp_error.c<br>
> @@ -121,7 +121,7 @@ __kmp_pragma(<br>
> kmp_str_buf_t buffer;<br>
> kmp_msg_t prgm;<br>
> __kmp_str_buf_init( & buffer );<br>
> - if ( 0 < ct && ct <= cons_text_c_num ) {;<br>
> + if ( 0 < ct ) {<br>
> cons = cons_text_c[ ct ];<br>
> } else {<br>
> KMP_DEBUG_ASSERT( 0 );<br>
> diff --git a/runtime/src/kmp_runtime.c b/runtime/src/kmp_runtime.c<br>
> index 55b58ce..0a08993 100644<br>
> --- a/runtime/src/kmp_runtime.c<br>
> +++ b/runtime/src/kmp_runtime.c<br>
> @@ -267,7 +267,8 @@ __kmp_check_stack_overlap( kmp_info_t *th )<br>
> }<br>
> <br>
> /* No point in checking ubermaster threads since they use refinement<br>
> and cannot overlap */<br>
> - if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid =<br>
> __kmp_gtid_from_thread( th )))<br>
> + gtid = __kmp_gtid_from_thread( th );<br>
> + if ( __kmp_env_checks == TRUE && !KMP_UBER_GTID(gtid))<br>
> {<br>
> KA_TRACE(10,("__kmp_check_stack_overlap: performing extensive<br>
> checking\n"));<br>
> if ( stack_beg == NULL ) {<br>
> <br>
> ---------------------------------------------------------------------<br>
> Intel Corporation (UK) Limited<br>
> Registered No. 1134945 (England)<br>
> Registered Office: Pipers Way, Swindon SN3 1RJ<br>
> VAT No: 860 2173 47<br>
> <br>
> 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.<br>
> _______________________________________________<br>
> Openmp-dev mailing list<br>
> </span><a href="mailto:Openmp-dev@dcs-maillist2.engr.illinois.edu"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Openmp-dev@dcs-maillist2.engr.illinois.edu</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><br>
> </span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev</span></a><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><br>
> <br>
<br>
-- <br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
---------------------------------------------------------------------<br>
Intel Corporation (UK) Limited<br>
Registered No. 1134945 (England)<br>
Registered Office: Pipers Way, Swindon SN3 1RJ<br>
VAT No: 860 2173 47<br>
<br>
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.</span><span lang="EN-US">
<o:p></o:p></span></p>
<p><span lang="EN-US">---------------------------------------------------------------------<br>
Intel Corporation (UK) Limited<br>
Registered No. 1134945 (England)<br>
Registered Office: Pipers Way, Swindon SN3 1RJ<br>
VAT No: 860 2173 47 <o:p></o:p></span></p>
<p><span lang="EN-US">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. <o:p></o:p></span></p>
</div>
</div>
<p><br>
--------------------------------------------------------------------<br>
Closed Joint Stock Company Intel A/O<br>
Registered legal address: Krylatsky Hills Business Park, <br>
17 Krylatskaya Str., Bldg 4, Moscow 121614, <br>
Russian Federation</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>