[llvm-bugs] [Bug 44747] New: Optimizer bug for ARM v7

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 31 14:11:01 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44747

            Bug ID: 44747
           Summary: Optimizer bug for ARM v7
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brianp at dashlogic.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 23078
  --> https://bugs.llvm.org/attachment.cgi?id=23078&action=edit
Android Studio example project, screenshots, assembly review

During our work with the pixman graphics library, we've discovered an optimizer
bug that results in incorrect bit shift math. There are no compile time errors,
but the output result is completely incorrect at runtime.

My development environment is using Windows 10, Android Studio v3.5.3, Android
NDK v20.0.5594570, with Clang v8.0.7. This bug appears to only happen when
targeting armeabi-v7a for 32-bit Android with -O1 or higher, and not for
arm64-v8a or any x86 variant.

I've attached an Android Studio sample project demonstrating the error, as well
as screenshots shots showing the invalid math calculation. Looking at
android.c, lines 8 and 10 cause the issue, where lines 17 and 19 do not (since
they are not optimized due to the optnone attribute). The data ends up in the
wrong byte position.

After looking through the generated assembly, it appears to be generating an
orr instruction with an incorrect shift value. I've attached a short review
showing some of the assembly differences between optimized and unoptimized
versions.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200131/10be67ba/attachment.html>


More information about the llvm-bugs mailing list