<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Wrong mapping assembly-line at Og"
   href="https://bugs.llvm.org/show_bug.cgi?id=51510">51510</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong mapping assembly-line at Og
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>artuso@diag.uniroma1.it
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Comment:
Line 14 is wrongly assigned to a xorl operation.

Steps to reproduce bug:

root@52f3e2c061bc:/home/stepping/output# clang -v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
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@52f3e2c061bc:/home/stepping/output# lldb -v
lldb version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a> revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
  clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
  llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f

root@52f3e2c061bc:/home/stepping/output# cat a.c
static int a, h;
char b, g;
static volatile int c;
static short d;
static char *e = &b;
int f;
int j;
int k[2];
int l;
int o() {
  int q, i = 0;
  char l_38[8];
  for (; i < 8; i++)
    l_38[i] = 0xBA;
  q = 0;
  for (; q <= 7; q++)
    if (l_38[q])
      a++;
  return h;
}
char r() {
m:
  *e = c;
  {
    int n = o();
    d = 5;
    for (; d <= 4; d = s()) {
      short p;
      if (2 | p) {
        if (t())
          return;
        for (; f; f++)
          ;
      } else
        goto m;
      if (l)
        break;
    }
  }
}
int main() {
  for (;;) {
    r();
    k[j] = 1;
    if (k[0])
      break;
    e = g;
    for (;;)
      ;
  }
}

root@52f3e2c061bc:/home/stepping/output# cat -n a.c
     1  static int a, h;
     2  char b, g;
     3  static volatile int c;
     4  static short d;
     5  static char *e = &b;
     6  int f;
     7  int j;
     8  int k[2];
     9  int l;
    10  int o() {
    11    int q, i = 0;
    12    char l_38[8];
    13    for (; i < 8; i++)
    14      l_38[i] = 0xBA;
    15    q = 0;
    16    for (; q <= 7; q++)
    17      if (l_38[q])
    18        a++;
    19    return h;
    20  }
    21  char r() {
    22  m:
    23    *e = c;
    24    {
    25      int n = o();
    26      d = 5;
    27      for (; d <= 4; d = s()) {
    28        short p;
    29        if (2 | p) {
    30          if (t())
    31            return;
    32          for (; f; f++)
    33            ;
    34        } else
    35          goto m;
    36        if (l)
    37          break;
    38      }
    39    }
    40  }
    41  int main() {
    42    for (;;) {
    43      r();
    44      k[j] = 1;
    45      if (k[0])
    46        break;
    47      e = g;
    48      for (;;)
    49        ;
    50    }
    51  }

root@52f3e2c061bc:/home/stepping/output# clang -Og -g -Wno-everything -o opt
a.c

root@52f3e2c061bc:/home/stepping/output# lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b 14
Breakpoint 1: 3 locations.
(lldb) r
Process 26 launched: '/home/stepping/output/opt' (x86_64)
Process 26 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.3
    frame #0: 0x0000000000400517 opt`main [inlined] o at a.c:14:13
   11     int q, i = 0;
   12     char l_38[8];
   13     for (; i < 8; i++)
-> 14       l_38[i] = 0xBA;
   15     q = 0;
   16     for (; q <= 7; q++)
   17       if (l_38[q])
(lldb) di -l
opt`main:
->  0x400517 <+23>: movq   %rdx, -0x8(%rsp)
    0x40051c <+28>: xorl   %edx, %edx
(lldb) si
Process 26 stopped
* thread #1, name = 'opt', stop reason = instruction step into
    frame #0: 0x000000000040051c opt`main [inlined] o at a.c:14:13
   11     int q, i = 0;
   12     char l_38[8];
   13     for (; i < 8; i++)
-> 14       l_38[i] = 0xBA;
   15     q = 0;
   16     for (; q <= 7; q++)
   17       if (l_38[q])
(lldb) di -l
opt`main:
    0x400517 <+23>: movq   %rdx, -0x8(%rsp)
->  0x40051c <+28>: xorl   %edx, %edx</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>