<div dir="ltr">Hello Bevin,<br>As per N1169 4.1.4 (Type conversion, usual arithmetic conversions), conversions between the fixed point and floating point is unspecified. I believe before looking/checking for conversions, we have to handle unsupported conversions, if the conversion is not possible, we have to return NULL.<br><br>Let me know your opinions. <br><br><i>Second patch updated:</i> Changed word from <b>"Comparision" </b>to<b> "Conversion", "Conversion"</b> is correct word to describe. This verified on the local build, it does not lead to a compiler crash.<br><br>Regards,<br>Nadaf.  <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 16, 2020 at 5:17 AM Bevin Hansson <<a href="mailto:bevin.hansson@ericsson.com">bevin.hansson@ericsson.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Gousemoodhin,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I don't think 4.1.4 mentions anything about comparisons. The only mention of unspecified with floating point is "The rounding of conversions from a fixed-point type to a floating point type is unspecified."</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
UsualArithmeticConversions and handleFixedPointConversion do not actually convert anything, they simply determine what the result type of the operation would be. So that would not be the place to 'determine' unspecified-ness; that would be a property of how
 the computation is performed in CodeGen or constant evaluation.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I'm assuming you are trying to implement the floating point portions of N1169. A lot of the necessary boilerplate is not in place for that, as I haven't had time to look at it much quite yet.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
/ Bevin<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="gmail-m_-4366774860292833211appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-4366774860292833211divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.llvm.org</a>> on behalf of Gousemoodhin Nadaf via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Sent:</b> Saturday, June 13, 2020 6:22 AM<br>
<b>To:</b> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Subject:</b> [cfe-dev] Fixed point and floating point comparision</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hello,<br>
When a comparison is made between the<b> fixed point and floating point</b>, the result is unspecified. Reference N1169 4.1.4 (Type conversion, usual arithmetic conversions).<br>
<br>
In code, for fixed-point number, <span style="color:rgb(0,0,0);white-space:pre-wrap">handleFixedPointConversion()(SemaExpr.cpp) is called,
</span> I need to return unspecified.<br>
<br>
<i>   <span style="color:rgb(0,0,0);white-space:pre-wrap">handleFixedPointConversion()</span>  {<br>
    if ((LHS is fixed point && RHS is floating point)  OR (RHS is fixed point && LHS is floating point)  )<br>
      return unspecified.<br>
    }</i><br>
<br>
please let me know If anyone has idea, how to return unspecified or handle an unspecified case in UsualArithmeticConversions.<br>
<br>
Regards,<br>
Nadaf.</div>
</div>
</div>

</blockquote></div>