[Bug jit/103562] Jitted code produces incorrect result when returning 3-member struct from internal function

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 6 13:46:08 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103562

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-12-06
                 CC|                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Thanks for the report. I added:

  gcc_jit_context_set_bool_option(ctxt, GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING,
1);
  gcc_jit_context_set_bool_option(ctxt, GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES,
1);

and I can see in the very first dump file:

$ cat fake.c.006t.gimple
struct my_struct deref (struct my_struct * ptr)
{
  <D.79>:
  <retval> = *ptr;
  return <retval>;
}


long int get_a (struct my_struct * ptr)
{
  long int D.87;
  struct my_struct D.88;

  <D.83>:
  D.88 = deref (ptr); [return slot optimization]
  D.87 = D.88.a;
  return D.87;
}

So there's fishy the [return slot optimization].
@David: Can you please take a look?


More information about the Gcc-bugs mailing list