[llvm-bugs] [Bug 51085] New: error caused by inlining function while compiling with -O3.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 13 20:21:38 PDT 2021


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

            Bug ID: 51085
           Summary: error caused by inlining function while compiling with
                    -O3.
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xin.liu at compiler-dev.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 25021
  --> https://bugs.llvm.org/attachment.cgi?id=25021&action=edit
Integer128 division

In attachment, The program is used to achieve the division with integer128.

Tested compiler was:

clang version 10.0.1
Target: aarch64-unknown-linux-gnu
Thread model: posix

When the dividend number is the minimum value of a negative number, the divisor
number is -1 and use the command 'clang -O3 div128.c', the result is 0, but the
expected value is the minimum value of negative number.When Compiling with O0
under clang or Compiling with O3 under gcc, the result is the expected value.

According to the assemble codes,I found that int128_count_leading_zeros()
function is inlined and the return value is 1 but expected as 0. And then I try
to add the noinline attribute for int128_count_leading_zeros() function, the
result is what I expected.

Therefore, I suspect that there is some problems with clang while handling of
inline optimization.Please confirm whether it is a clang problem.

-- 
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/20210714/b1520073/attachment-0001.html>


More information about the llvm-bugs mailing list