On 02/09/2015 11:16 AM, Richard Biener wrote:

Thus, if your patch survives LTO bootstrap and you can still LTO
a TU with ms_abi valist functions successfully (not sure if that's
exercised in the testsuite) then it is fine.

I've now done the LTO bootstrap, and the program below compiled with -flto still works. Does that seem sufficient?

Note that I _did_ run into issues with excempting nodes from
preloading because of pointer comparisons.  The issue is that
types created by the backends and the middle-end do not
participate in the type merging done by LTO.  Thus the actual
issue may be not on x86 (because it implements
the canonical_va_list_type hook) but on other targets that
end up using std_canonical_va_list_type.

Hmm. That doesn't really make me want to commit it at this stage of the development process.


Bernd

#include <stdarg.h>
#include <cross-stdarg.h>
#include <stdio.h>
#include <stdlib.h>

static int x;
static const char *y;

__attribute__((noinline,noclone)) static void verror_msg(va_list p)
{
  x = va_arg (p, int);
  y = va_arg (p, const char *);
}

__attribute__((noinline,noclone)) static void err(int errnum, const char *s, 
...)
{
  va_list p;

  va_start(p, s);
  verror_msg(p);
  va_end(p);
}

__attribute__((noinline,noclone,ms_abi)) static void verror_msg2(ms_va_list p)
{
  x = va_arg (p, int);
  y = va_arg (p, const char *);
}

__attribute__((noinline,noclone,ms_abi)) static void err2(int errnum, const 
char *s, ...)
{
  ms_va_list p;

  __ms_va_start (p, s);
  verror_msg2 (p);
  __ms_va_end(p);
}

int main ()
{ 
  const char *p1 = "t1";
  const char *p2 = "t2";
  err (0, "test", 3, p1);
  if (x != 3 || y != p1)
    abort ();
  err2 (0, "ms", 2, p2);
  if (x != 2 || y != p2)
    abort ();
  exit(0);
}

Reply via email to