[cfe-dev] Possible bug when using -O2/-O3 in clang 13 for ARMv7

David Spickett via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 13 02:27:34 PST 2021


FWIW I think opening an issue with what you've got would be fine.

> when I build JSC using either -O2 or -O3, I get random garbage when querying for the "Infinity" constant from javascript

Can you elaborate on what JSC is and how you do the query? Is it something like:
* build an interpreter
* interpret javascript code that prints infinity
* check for expected value

I know zero about javascript in general but if we can get a script to
do that then we could bisect it. It'll take a while but we (Linaro)
have access to some machines that could help there.
(assuming this presents on armv8 hardware, but if it doesn't it's at
least a data point)

> It seems like some optimization introduced by -O2 is causing the issue.

Agreed

> Is there a flag in clang to print which optimizations are enabled for -O1 and -O2 so I can diff them?

Yes but I can never remember which one it is, so let me try to find
it. Unless someone else knows it already and can reply.

On Sat, 11 Dec 2021 at 18:01, Mikhail R. Gadelha via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> Hi everyone,
>
> 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.
>
> Some tests I did:
> 1. Using -O1 or no optimization doesn't trigger the issue.
> 2. Using either -O2 or -O3 with address or the undef behavior sanitizers doesn't trigger the issue.
> 3. Building JSC with clang 11.0.1-2 (from Debian) and clang 12.0.1 (from github) doesn't trigger the issue.
> 4. The issue happens with clang 13.0.0 (from github) and the 13.0.1-rc1 (also from github).
>
> It seems like some optimization introduced by -O2 is causing the issue.
>
> 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?
>
> 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.
>
> Thanks in advance,
>
> --
>
> Mikhail R. Gadelha.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


More information about the cfe-dev mailing list