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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-01-07
                 CC|                            |msebor at gcc dot gnu.org
      Known to work|                            |9.2.0
     Ever confirmed|0                           |1
      Known to fail|                            |10.0

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed with today's top of trunk.  A smaller test case is below.  The
original dump looks correct but the Gimple dump is not.  The store to a.a[0] is
missing from foobar(). 

$ cat pr93143.C && gcc -O2 -S -Wall -fdump-tree-gimple=/dev/stdout pr93143.C
struct A { char a[2]; };

static constexpr A foo () { return A{1}; }

void bar ()
{
  A a = foo ();
  if (a.a[0] != 1)
    __builtin_abort(); 
}

void foobar ()
{
  A a = foo ();
  if (a.a[0] != 1)
    __builtin_abort(); 
}
bar ()
{
  struct A a;

  try
    {
      a = {};
      a.a[0] = 1;
      _1 = a.a[0];
      if (_1 != 1) goto <D.2378>; else goto <D.2379>;
      <D.2378>:
      __builtin_abort ();
      <D.2379>:
    }
  finally
    {
      a = {CLOBBER};
    }
}


foobar ()
{
  struct A a;

  try
    {
      a = {};
      _1 = a.a[0];
      if (_1 != 1) goto <D.2380>; else goto <D.2381>;
      <D.2380>:
      __builtin_abort ();
      <D.2381>:
    }
  finally
    {
      a = {CLOBBER};
    }
}

Reply via email to