<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">s/NaN/infinity/, but that’s the gist of it.</div><div class=""><br class=""></div><div class="">– Steve</div><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 18, 2015, at 1:50 PM, Reid Kleckner via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">LLVM believes that floating point division will never trap, and speculates it to make code like this:<div class="">float tmp = 1.0 / scale;</div><div class="">scale = scale == 0.0 ? scale : tmp;</div><div class=""><br class=""></div><div class="">Normally, FP division produces NaN. The only way that I'm aware of to make FP div trap is to use fenv.h, which isn't supported:</div><div class=""><a href="https://llvm.org/bugs/show_bug.cgi?id=8100" class="">https://llvm.org/bugs/show_bug.cgi?id=8100</a><br class=""></div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Wed, Nov 18, 2015 at 2:15 AM, Shriramana Sharma via cfe-dev<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Hello. I'm using Clang 3.7~svn251177-1~exp1 from the Apt repo on<br class="">Kubuntu Trusty 64 bit. I'm trying to backport Asymptote from Debian<br class="">Sid:<span class="Apple-converted-space"> </span><a href="https://packages.debian.org/sid/asymptote" rel="noreferrer" target="_blank" class="">https://packages.debian.org/sid/asymptote</a><br class=""><br class="">I find that the build fails with:<br class=""><br class="">../asy -dir ../base -config "" -render=0 -f pdf -noprc filegraph.asy<br class="">../base/plain_Label.asy: 294.10: runtime: Floating point exception (core dumped)<br class=""><br class="">When I investigated this I found that there was no problem when<br class="">compiling with GCC.<br class=""><br class="">Please note the attached script which should demonstrate the error.<br class="">Running the script with -g will compile using the "default" compiler<br class="">(gcc) and does not produce any error.<br class=""><br class="">I used KDbg to debug the situation i.e. run the executable asy with<br class="">the given arguments which produced the error during the build and<br class="">found that at pair.h, line 148 reads:<br class=""><br class="">if(scale != 0.0) scale=1.0/scale;<br class=""><br class="">but it is at this point that despite the if() check, during one<br class="">particular invocation to pair unit(const pair&), somehow the program<br class="">is trying to do the division and getting the error.<br class=""><br class="">Note that for some reason during debugging I keep getting SIGPWR,<br class="">SIGXCPU etc – I don't know why this is but it is perhaps because asy<br class="">implements a virtual machine which does not support debugging or such?<br class="">Anyhow, repeatedly trying to run the executable with the given<br class="">arguments produces the error in the end.<br class=""><span class="HOEnZb"><font color="#888888" class=""><br class="">--<br class="">Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा<br class=""></font></span><br class="">_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class=""><br class=""></blockquote></div><br class=""></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">cfe-dev mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:cfe-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">cfe-dev@lists.llvm.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></div></blockquote></div><br class=""></body></html>