[llvm-bugs] [Bug 35379] New: Exception handling miscompile with -Oz on ARM

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 22 00:34:59 PST 2017


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

            Bug ID: 35379
           Summary: Exception handling miscompile with -Oz on ARM
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: srhines at google.com
                CC: chh at google.com, kongy.dev at gmail.com,
                    kristof.beyls at arm.com, llvm-bugs at lists.llvm.org,
                    peter.smith at linaro.org, pirama at google.com

This is a matching bug for https://github.com/android-ndk/ndk/issues/573 in the
Android NDK bug tracker. The issue can be seen with
https://github.com/rprichard/android-ndk-r16-miscompilation which uses two
source files to create some C++ routines that throw exceptions. I think it is
easiest to say with Ryan's reduced example at https://godbolt.org/g/rJRr75.
This code is clearly squashing r10 on line 31 of the assembly code.

My suspicion here is an "optimization" to keep code size down that creates a
small amount of extra stack space by pushing unused registers. This would be
instead of doing this with an extra instruction that just subtracts from the
stack frame. The bug then is that the .save directive specifies those extra
registers, such that any unwinding here will unexpectedly clobber the register
with the temporary. Those registers are only there to create 4 or 8 bytes of
extra storage, and aren't normally restored in the normal code exit path.

-- 
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/20171122/ee43c9aa/attachment.html>


More information about the llvm-bugs mailing list