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

    <tr>
        <th>Summary</th>
        <td>
            Inaccurate Debug Information: Union Variable Value Exceeds Valid Range
        </td>
    </tr>

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

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

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

<pre>
    This is another problem with the debug information for the loop in the #104531. The value of the union variable should not theoretically be 55 (the boundary is from -1 to 53 for this loop), but at line 35, it incorrectly shows as l_5 = {f0 = 55, f1 = 55} both in LLDB context and GDB context.

```
(lldb)file 379_O2.out
(lldb) b 35
(lldb) r
[...]
* thread #1, name = '379_O2.out', stop reason = breakpoint 1.1
    frame #0: 0x000055555555517c 379_O2.out`main [inlined] func_1 at 379.c:35:33
   32           if (l_8)
   33    break;
   34       }
-> 35            for (l_5.f1 = (-1); (l_5.f1 != 54); l_5.f1 = l_5.f1 + 1)
   36       { 
   37           int32_t *l_11 = (void*)0;
   38           int32_t *l_12[9] = {(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0};
(lldb) fr v
(U5) l_5 = (f0 = 55, f1 = 55)


(lldb) version
lldb version 18.1.8 (https://github.com/llvm/llvm-project.git revision 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
  clang revision 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff
  llvm revision 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff

```

```
(gdb) file 379_O2.out
(gdb) b 35
(gdb) r
[...]
35          for (l_5.f1 = (-1); (l_5.f1 != 54); l_5.f1 = l_5.f1 + 1)
(gdb) p l_5
$1 = {f0 = 55, f1 = 55}


$ gdb --version
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
Copyright (C) 2024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