[llvm-bugs] [Bug 51507] New: Wrong mapping assembly-line at Og

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 17 08:03:55 PDT 2021


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

            Bug ID: 51507
           Summary: Wrong mapping assembly-line at Og
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: artuso at diag.uniroma1.it
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Comment:
Line 8 is wrongly assigned to a shift assembly instruction.

Steps to reproduce bug:

root at 14f37d90482b:/home/stepping/output# clang -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
957334382cd12ec07b46c0ddfdcc220731f6d80f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

root at 14f37d90482b:/home/stepping/output# lldb -v
lldb version 14.0.0 (https://github.com/llvm/llvm-project.git revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
  clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
  llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f

root at 14f37d90482b:/home/stepping/output# cat a.c
int a, b;
int *g_3377 = &b;
int main() {
  short c;
  char l_3718[7][4];
  c = 3 > 7 >> a ? 0 : 3 << a;
  l_3718[6][3] = c;
  (*g_3377) = l_3718[6][3];
}

root at 14f37d90482b:/home/stepping/output# cat -n a.c
     1  int a, b;
     2  int *g_3377 = &b;
     3  int main() {
     4    short c;
     5    char l_3718[7][4];
     6    c = 3 > 7 >> a ? 0 : 3 << a;
     7    l_3718[6][3] = c;
     8    (*g_3377) = l_3718[6][3];
     9  }

root at 14f37d90482b:/home/stepping/output# clang -Og -g -Wno-everything -o opt
a.c

root at 14f37d90482b:/home/stepping/output# lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b 8
Breakpoint 1: where = opt`main + 18 at a.c:8:15, address = 0x0000000000400492
(lldb) r
Process 30 launched: '/home/stepping/output/opt' (x86_64)
Process 30 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400492 opt`main at a.c:8:15
   5      char l_3718[7][4];
   6      c = 3 > 7 >> a ? 0 : 3 << a;
   7      l_3718[6][3] = c;
-> 8      (*g_3377) = l_3718[6][3];
   9    }
(lldb) di -l

-> 3    int main() {
-> 4      short c;
-> 5      char l_3718[7][4];
-> 6      c = 3 > 7 >> a ? 0 : 3 << a;
-> 7      l_3718[6][3] = c;
-> 8      (*g_3377) = l_3718[6][3];

opt`main:
->  0x400492 <+18>: shll   %cl, %edx
    0x400494 <+20>: sarl   $0x18, %edx
    0x400497 <+23>: xorl   %ecx, %ecx

-- 
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/20210817/1cc619bf/attachment-0001.html>


More information about the llvm-bugs mailing list