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: unassignedclangb...@nondot.org
          Reporter: bri...@dashlogic.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to