<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Le 6 juin 08 à 18:47, Dale Johannesen a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 6, 2008, at 8:51 AM, Jean-Daniel Dupas wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div><br></div><div>I'm playing with llvm/clang and I have a problem when I try to use the -ast-print options for a file that uses long double.</div><div><br></div><div>The Basic/Targets.cpp file defined the x86 (and x86_64) long double type as <span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span style="color: rgb(92, 38, 153); ">APFloat</span>::x87DoubleExtended.</span></div><div><font class="Apple-style-span" face="Monaco" size="2"><font class="Apple-style-span" color="#000000" face="Helvetica" size="3">Then, when the AST printer try to write a long double literal value (using</font> VisitFloatingLiteral()<font class="Apple-style-span" color="#000000" face="Helvetica" size="3">), it call <span class="Apple-style-span" style="color: rgb(63, 110, 116); font-family: Monaco; font-size: 10px; ">FloatingLiteral-><span class="Apple-style-span" style="color: rgb(0, 0, 0); ">getValueAsDouble() </span><font class="Apple-style-span" color="#000000" face="Helvetica" size="3">and the later does not support long double, so it try to call <font class="Apple-style-span" color="#000000">convertToDouble() as a fallback and crash due to an invalid assertion. <span class="Apple-style-span" style="font-family: Courier; font-weight: bold; ">APFloat.cpp:2631: failed assertion `semantics == (const llvm::fltSemantics*)&IEEEdouble'</span></font></font></span></font></font></div><div><font class="Apple-style-span" face="Courier"><b><br></b></font></div><div>This is a know issue as some there is some comments like "<span class="Apple-style-span" style="color: rgb(0, 116, 0); font-family: Monaco; font-size: 10px; ">// FIXME: We need something for long double here." </span><font class="Apple-style-span" color="#000000">in <span class="Apple-style-span" style="color: rgb(63, 110, 116); font-family: Monaco; font-size: 10px; ">FloatingLiteral-><span class="Apple-style-span" style="color: rgb(0, 0, 0); ">getValueAsDouble()</span><font class="Apple-style-span" color="#000000" face="Helvetica" size="3">, and "<span class="Apple-style-span" style="color: rgb(0, 116, 0); font-family: Monaco; font-size: 10px; ">// FIXME: print value more precisely." </span><font class="Apple-style-span" color="#000000">in <span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; ">VisitFloatingLiteral()<span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">. </span></span></font></font></span></font></div><div><br></div><div>I wonder what will be the best way to solve those both issue.  Has somebody planned to add support for long double to APInt and APFloat ?</div></div></div></blockquote><br></div><div>There are no plans to support the use of host long double anywhere, if that's what you mean.  </div><div><br class="webkit-block-placeholder"></div><div>Probably this dumper should use APFloat::convert to get the long double into APFloat::IEEEdouble format (with loss of precision; the comment claims that's OK), then use convertToDouble on that.  If you want full precision, you'll need to print all the bits in hex; see EmitGlobalConstant in AsmPrinter.cpp.</div></div></blockquote><br></div><div>Thank you for the reply, it give me some track to investigate.</div><div><br></div></body></html>