This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Aliasing brokenness (Was: Re: [patch RFC] SH: Use FRAME_GROWS_DOWNWARD)


Daniel Berlin wrote:



I'm confused.
It looks like one type is a builtin_va_list and one type is a va_list,
which don't seem to share anything in common.





It's a two-level typedef. I've attached the preprocessed testcase.
# 1 "std-k.c"
# 0 "<built-in>"
# 1 "<command line>"
# 1 "std-k.c"
# 1 "/mnt/scratch/nightly/sh-elf-4-1-20050718/sh-elf/gcc/include/stdarg.h" 1 3 4
# 43 "/mnt/scratch/nightly/sh-elf-4-1-20050718/sh-elf/gcc/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 105 "/mnt/scratch/nightly/sh-elf-4-1-20050718/sh-elf/gcc/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 2 "std-k.c" 2

extern void abort (void);

int foo_arg, bar_arg;

void
foo (int v, va_list ap)
{
  foo_arg = __builtin_va_arg(ap,int);
  foo_arg += __builtin_va_arg(ap,long double);
}

struct A { int i; va_list g; va_list h[2]; };

void
f12 (int i, ...)
{
  struct A a;
  __builtin_va_start(a.h[1],i);
  foo (i, a.h[1]);
  __builtin_va_end(a.h[1]);
}

int
main (void)
{
  f12 (11, 2030, 12.0L);
  if (foo_arg != 2042)
    abort ();
  return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]