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

            Bug ID: 92992
           Summary: Side-effects dropped when decltype(nullptr) typed
                    expression is passed to ellipsis
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

GCC 4.6 and later miscompiles:
int a;

void
bar (int, ...)
{
}

decltype (nullptr)
baz ()
{
  a++;
  return nullptr;
}

int
main ()
{
  bar (0, baz ());
  if (a != 1)
    __builtin_abort ();
}

We replace the baz () call with nullptr even when it has side-effects.

Reply via email to