<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 - GDB. test gdb.base/infcall-nested-structs-c++.exp failing after 6f7f5b54c"
   href="https://bugs.llvm.org/show_bug.cgi?id=51813">51813</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GDB. test gdb.base/infcall-nested-structs-c++.exp failing after 6f7f5b54c
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>douglas_yung@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Internally we run the GDB test suite, and one test
gdb.base/infcall-nested-structs-c++.exp started to fail after commit
6f7f5b54c81be59ec7876649d1f9aa6b104658ec.

I have reduced the test to the following source which should reproduce the
failure.

/* complex.c */
typedef float _Complex tfc;

struct struct_01_01 { struct { } es1; struct { struct { tfc a; } s1; } s2; };

struct struct_01_01 ref_val_struct_01_01 = { {}, { { 'a' } } };

int __attribute__((noinline))
cmp_struct_01_01 (struct struct_01_01 a, struct struct_01_01 b){
  return a.s2.s1.a == b.s2.s1.a;
}

extern int __attribute__((noinline)) check_arg_struct_01_01 (struct
struct_01_01 arg) {
  return cmp_struct_01_01 (arg, ref_val_struct_01_01);
}

struct struct_01_01 __attribute__((noinline))
rtn_str_struct_01_01 (void) {
  return (ref_val_struct_01_01);
}

int volatile v = 1;

void __attribute__((noinline))
breakpt (void)
{  v++; }

int main () {
  int res;

  res = check_arg_struct_01_01 (ref_val_struct_01_01);
  breakpt ();
  return res; /* Break here */
}
/* End complex.c */

Compile the file with "clang++ complex.c -x c++ -O2 -g -o test.out". Then start
up GDB to debug the resulting executable. Within GDB, set a breakpoint on the
line with the comment "Break here" (line 32 in my copy), and run the debugger.
When the debugger stops at line 32, run the command "p/d check_arg_struct_01_01
(ref_val_struct_01_01)". The result of that should be 1, but after upstream
commit 6f7f5b54c81be59ec7876649d1f9aa6b104658ec it is now 0.

Sample good debug session:
dyung@aldebaran:~/sandbox/gdb$ gdb good.out
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
...
Reading symbols from good.out...
(gdb) b 32
Breakpoint 1 at 0x4011ad: file complex.c, line 32.
(gdb) r
Starting program: /home/dyung/sandbox/gdb/good.out 

Breakpoint 1, main () at complex.c:32
32        return res; /* Break here */
(gdb) p/d check_arg_struct_01_01 (ref_val_struct_01_01)
$1 = 1


Sample bad debug session:
dyung@aldebaran:~/sandbox/gdb$ gdb bad.out
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
...
Reading symbols from bad.out...
(gdb) b 32
Breakpoint 1 at 0x40121c: file complex.c, line 32.
(gdb) r
Starting program: /home/dyung/sandbox/gdb/bad.out 

Breakpoint 1, main () at complex.c:32
32        return res; /* Break here */
(gdb) p/d check_arg_struct_01_01 (ref_val_struct_01_01)
$1 = 0


In my sample gdb output, good.out was built using a compiler built from
b978df4af4c8a668550fa035b70795312bf41f44, while bad.out was built using a
compiler built from 6f7f5b54c81be59ec7876649d1f9aa6b104658ec.</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>