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

--- Comment #2 from vries at gcc dot gnu.org ---
minimal version of stdarg-1.c, returns 14 if correct, but 12 for current
failure, indicating that the the first and resultless va_arg has been ignored:
...
include <stdarg.h>

extern void exit (int);

int
f6 (int i, ...)
{
  int res;

  va_list ap;
  va_start (ap, i);

  va_arg (ap, long);

  res = va_arg (ap, long);

  va_end (ap);

  return res;
}

int
main (void)
{
  int res = f6 (7, 12L, 14L);
  exit (res);
}
...

The expression returned by gimpify_va_arg_internal is:
...
(gdb) call debug_generic_expr ($1)
*D.2689 >= 0 ? ap.__stack = (void *) ((long int) D.2690 + 15 & -8);, (long int
*) D.2690; : ap.__gr_offs = D.2689 + 8;, ap.__gr_offs > 0 ? ap.__stack = (void
*) ((long int) D.2690 + 15 & -8);, (long int *) D.2690; : (long int *)
ap.__gr_top + (sizetype) D.2689;
...

Indeed, not side-effect free.

This is most likely a duplicate of PR65818.

Reply via email to