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

    <tr>
        <th>Summary</th>
        <td>
            [Clang][RISCV] ABI differene between GCC and LLVM for nested empty structure in C++ 
        </td>
    </tr>

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

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

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

<pre>
    Option: -O2 -S -march=rv64imafdc -mabi=lp64d

```
typedef float _Complex tfc;

struct struct_01_03 {
  struct {  struct {  struct { } es1;  }s1;  } s2; 
  struct { } es1; 
  struct {   struct { tfc a; } s3; } s4;
};

struct struct_01_03 ref_val_struct_01_03 = { { { {} } }, {}, { { 'a' } } };

static int __attribute__((noinline))
cmp_struct_01_03 (struct struct_01_03 a, struct struct_01_03 b)
{
  return a.s4.s3.a == b.s4.s3.a;
}

int __attribute__((noinline)) check_arg_struct_01_03 (struct struct_01_03 arg)
{
  return cmp_struct_01_03 (arg, ref_val_struct_01_03);
}

struct struct_01_03 __attribute__((noinline)) rtn_str_struct_01_03 (void)
{
  return (ref_val_struct_01_03);
}

int main()
{
  int val = 0;
  val += check_arg_struct_01_03 (rtn_str_struct_01_03 ());
  return 0;
}
```

This [case](https://godbolt.org/z/x55dMv3hM) is reduced by [infcall-nested-structs.c ](https://github.com/bminor/binutils-gdb/blob/master/gdb/testsuite/gdb.base/infcall-nested-structs.c) in GDB testsuite.  The arguments are passed by fpr in GCC but gpr in LLVM.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVd9vmzAQ_mvg5RREzK_kgYcmUadJqyZt016RMQd4MwbZJlv3188G2qYt6brIhvPZ9_n7zodT9tV9_nkwvJdedAObzwQ2X2HTUcVaLzqpcxrzjtYVc76SW5cY0rjywpMX3izPNFzaNDT3A1ZYQy16aqA49t0g8DeYmnnR4TJOGzUyA_OrCLdFGIGXLUtg8TvPVdvLToB6a3HB2U8WaOLMFaiLkLWNLgeWMdBpoQOMHq34SUd2eocmhXVxpqJ4LjQ6LXweuwNfukeOi2ex5k4yajtcLny5PTWcAZc28QU1RvFyNFgUHtnZJnsuBZfokb1rUwTrhhfEyG5NBHVE1ibKR6iLs1NoRiWBBjoOdBRQJ9cpLh8cz1J4IeBdzIG1yH4WVDXvo66aNziuJWCKOK4enEO6wn1t739rUUa6DV5xOPe8eoO2XfGf9FxqO8rlxOI1rpu2aFNhho8YMPvIwbmvp_2aiKXSopfswxWSz2-R-fmt5Rq85MCoRi-xH8OuNWbQ9qbyyK1tTV-VvTBB7w7s9o_tv5OkujtH7Z3LrQ1WWI0MKyjvHQ6XNaNCbCRqg9VmpqsDBqvg3LRjGbC-s4Oy47JXzuByNFzoTVOVbih69-qoBXTTs9dYfD1yg7MnKB1_cntt-4mrhA8ne-k8RAYA31p0xTt2KI22FsJAtZ7F1IOaQo5HsMUFzTz89On7XeBjvk3T3TYhaRj6VR5V-2hPfcONwNwm4SiobJzg5PDl49fjd2vCzeEjVLyuUaFEKNH8QpzRqawmWKh7BTNxwG4w90uhj5aW3fnoaoQcwB-VyN_IoxDnh9dmUP0PZMYlRusRtTWS3Z7s_Tavs4TRdJdEEdY0worRekcSlsRhRrYlTXxBSxTayfEIkfgLJghrWzU-z0lIyNb-wiyOSBjQjEZ1mqUx2n8yUsdeHKL9FkTgeLjq8VU-USrHRttJwe0pPE3arPNG4pQ9h09H0_Yq1y3tWTvKxp82zyfyfwHDWSx_">