<div dir="ltr"><div>Hi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em seg., 13 de dez. de 2021 às 06:27, David Spickett <<a href="mailto:david.spickett@linaro.org">david.spickett@linaro.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">FWIW I think opening an issue with what you've got would be fine.<br>
<br></blockquote><div><br></div><div>Cool, I'll try to add the information here and open the github issue.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> when I build JSC using either -O2 or -O3, I get random garbage when querying for the "Infinity" constant from javascript<br>
<br>
Can you elaborate on what JSC is and how you do the query? Is it something like:<br>
* build an interpreter<br>
* interpret javascript code that prints infinity<br>
* check for expected value<br></blockquote><div><br></div><div>Right, so to build JSC, you need to get WebKit from <a href="https://github.com/WebKit/WebKit">https://github.com/WebKit/WebKit</a> (shallow clone is a friend here), and run:</div><div><br></div><div>$ ./Tools/Scripts/build-jsc --Release --jsc-only '--cmakeargs=-DCMAKE_CXX_COMPILER=<path-to-clang-13>/bin/clang++ -DCMAKE_C_COMPILER=<path-to-clang-13>/bin/clang'</div><div><br></div><div>Release by default builds with -O3 -DNDEBUG. JSC will be built in WebKitBuild/Release/bin/jsc.</div><div><br></div><div>To build the debug version, you must replace --release by --debug, and JSC will be built in WebKitBuild/Debug/bin/jsc. To rebuild, you can either remove the WebKitBuild dir, or go in WebKitBuild/Release/ and do a ninja clean + ninja.</div><div><br></div><div>The program I'm using is:</div><div><br></div><div>$ cat foo.js<br>print(Infinity)<br>let a = Infinity / Infinity<br>print(Number.isNaN(a))<br></div><div><br></div><div>JSC built in release mode (the value infinity changes every time):</div><div><br></div><div>$ WebKitBuild/Release/bin/jsc foo.js</div><div>-1.1089394371691584e+269<br>false<br></div><div><br></div><div>Expected output:</div><div>$ ./WebKitBuild/Debug/bin/jsc foo.js<br>Infinity<br>true<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I know zero about javascript in general but if we can get a script to<br>
do that then we could bisect it. It'll take a while but we (Linaro)<br>
have access to some machines that could help there.<br>
(assuming this presents on armv8 hardware, but if it doesn't it's at<br>
least a data point)<br></blockquote><div><br></div><div>I'm using: </div><div><br></div><div>$ uname -a<br>Linux bbox-11-armhf 5.10.0-0.bpo.7-arm64 #1 SMP Debian 5.10.40-1~bpo10+1 (2021-06-04) armv8l GNU/Linux<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> It seems like some optimization introduced by -O2 is causing the issue.<br>
<br>
Agreed<br>
<br>
> Is there a flag in clang to print which optimizations are enabled for -O1 and -O2 so I can diff them?<br>
<br>
Yes but I can never remember which one it is, so let me try to find<br>
it. Unless someone else knows it already and can reply.<br>
<br>
On Sat, 11 Dec 2021 at 18:01, Mikhail R. Gadelha via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Hi everyone,<br>
><br>
> This is kind of a follow-up to my previous email about compiling JSC using clang for ARMv7: when I build JSC using either -O2 or -O3, I get random garbage when querying for the "Infinity" constant from javascript, as if the constant was not being initialized. The variable is being initialized correctly, that I'm sure.<br>
><br>
> Some tests I did:<br>
> 1. Using -O1 or no optimization doesn't trigger the issue.<br>
> 2. Using either -O2 or -O3 with address or the undef behavior sanitizers doesn't trigger the issue.<br>
> 3. Building JSC with clang 11.0.1-2 (from Debian) and clang 12.0.1 (from github) doesn't trigger the issue.<br>
> 4. The issue happens with clang 13.0.0 (from github) and the 13.0.1-rc1 (also from github).<br>
><br>
> It seems like some optimization introduced by -O2 is causing the issue.<br>
><br>
> Does anyone have any tips I can follow to improve this bug report? I'll try to compile JSC with -O2 and disable the optimizations manually to pinpoint what's causing the issue (hopefully it's a single optimization and not a combination of them). Is there a flag in clang to print which optimizations are enabled for -O1 and -O2 so I can diff them?<br>
><br>
> I wish I had more information, but I'm still trying to debug why this is happening. I wanted to try to get more information first before opening a github issue.<br>
><br>
> Thanks in advance,<br>
><br>
> --<br>
><br>
> Mikhail R. Gadelha.<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div></div>