http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56205



             Bug #: 56205

           Summary: [4.8 Regression] stdarg pass confused by jump

                    threading

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Keywords: wrong-code

          Severity: normal

          Priority: P3

         Component: tree-optimization

        AssignedTo: ja...@gcc.gnu.org

        ReportedBy: ja...@gcc.gnu.org





#include <stdarg.h>



int a, b;

char c[128];



static void

foo (int x, char const *y, va_list z)

{

  __builtin_printf ("%s %d %s", x ? "" : "foo", ++a, (y && *y) ? "bar" : "");

  if (y && *y)

    __builtin_vprintf (y, z);

}



void

bar (int x, char const *y, ...)

{

  va_list z;

  va_start (z, y);

  if (!x && *c == '\0')

    ++b;

  foo (x, y, z);

  va_end (z);

}



at -O3 (distilled from MariaDB testcase framework) fails on ppc64, only

floating point registers are saved, but not GPRs needed for varargs.

bar: va_list escapes 0, needs to save 0 GPR units and all FPR units.

from stdarg pass is wrong, va_list escapes in this case.

Reply via email to