<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/108018>108018</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [LLDB]When lldb prints the array, it gets different values
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          IOVOVHS
      </td>
    </tr>
</table>

<pre>
    This is an interesting thing, got different values under different versions of lldb debugger, but using gdb debugging, got the correct values. Unlike the previous   submission(https://github.com/llvm/llvm-project/issues/107977) for testing (lldb printed 0 for all optimized array elements), this time it was a case of getting different values.

the value of l_1151[4] is 0. -- O0 level.  lldb-19
``` c
(lldb) b 310
Breakpoint 1: where = random_876`func_1 + 707 at random_876.c:310:11, address = 0x00000000000093c3
(lldb) r
Process 437528 launched: '/home/hzw/experiment/csmith_prog/clang_O0/random_876' (x86_64)
Process 437528 stopped
* thread #1, name = 'random_876', stop reason = breakpoint 1.1
    frame #0: 0x000055555555d3c3 random_876`func_1 at random_876.c:310:11
   307          }
   308          for (i = 0; i < 5; i++)
   309              l_1322[i] = (void*)0;
-> 310          (*g_6) = &g_5;
   311          (*g_10) = g_8;
   312      }
   313      (*g_7) = (g_1213.f1 && (*l_1441));
(lldb) p l_1151[4]
(int32_t) $0 = 0

```
the value of l_1151[4] is different -- O2 level.  lldb-19

``` c
(lldb) b 310
Breakpoint 1: where = random_876`main [inlined] func_1 at random_876.c:310:11, address = 0x0000000000007c90
(lldb) r
Process 437607 launched: '/home/hzw/experiment/csmith_prog/clang_O2/random_876' (x86_64)
Process 437607 stopped
* thread #1, name = 'random_876', stop reason = breakpoint 1.1
    frame #0: 0x000055555555bc90 random_876`main [inlined] func_1 at random_876.c:310:11
   307          }
   308          for (i = 0; i < 5; i++)
   309              l_1322[i] = (void*)0;
-> 310          (*g_6) = &g_5;
   311          (*g_10) = g_8;
   312      }
   313      (*g_7) = (g_1213.f1 && (*l_1441));
(lldb) p l_1151[0]
(int32_t) 0
(lldb) p l_1151[4]
(int32_t) -1922683376
```

the debug-info printed by llvm-dwarfdump.So, this array has only one constant 0.
```
0x00000823:     DW_TAG_variable
                  DW_AT_name    ("l_1151")
                  DW_AT_decl_file       ("/home/hzw/experiment/csmith_prog/./random_876.c")
                  DW_AT_decl_line       (270)
                  DW_AT_type    (0x00000981 "int32_t[9]")
0x00000ac0:       DW_TAG_variable
                    DW_AT_const_value   (0)
                    DW_AT_abstract_origin       (0x00000823 "l_1151")

```
the source file:
``` c
 269     union U4 ***l_1119[2];
 270     int32_t l_1151[9] = {0L,0L,0L,0L,0L,0L,0L,0L,0L};
 271     uint16_t l_1155 = 1UL;
....
 322    .....   )) , &l_1151[0]) != (void*)0), ..... 
......
```

I also tried lldb-10 and lldb-15 and got different wrong values. Only the value of l_1151[0] is correct, which is 0, and the values ​​of the rest of the array elements are different. In the source code, the value of the array has not been updated, it should be just the initial value.

clang version 19.0.0git (https://github.com/llvm/llvm-project.git b4ab52c8e71e819c13606de3500043eaa701e1ea)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/hzw/Downloads/llvm-project/build/bin
Build config: +unoptimized, +assertions

lldb version 19.0.0git (https://github.com/llvm/llvm-project.git revision b4ab52c8e71e819c13606de3500043eaa701e1ea)
  clang revision b4ab52c8e71e819c13606de3500043eaa701e1ea
  llvm revision b4ab52c8e71e819c13606de3500043eaa701e1ea


Please also let me know if I'm doing anything wrong, like an incorrect version or something.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWN2P4ygS_2vISykWH_HXQx6SyfbdSCP1Sjuz82hhQxx2CESAO93715_Aztd1Zrb7du_uZa2W4waqgF_Vr6iCe696I-US5WuUb2Z8CDvrlh8ff3389Z-_zForXpafd8qD8sANKBOkkz4o00PYKdMj-gF6G0Co7VY6aQI8cT1ID4MR0l03S-eVNR7sFrQWLQjZDn0v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