OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [stackalign/] [vararg-1.c] - Blame information for rev 424

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
 
3
#include <stdarg.h>
4
#include "check.h"
5
 
6
#ifndef ALIGNMENT
7
#define ALIGNMENT       64
8
#endif
9
 
10
typedef int aligned __attribute__((aligned(ALIGNMENT)));
11
 
12
int global;
13
 
14
void
15
bar (char *p, int size)
16
{
17
  __builtin_strncpy (p, "good", size);
18
}
19
 
20
void
21
foo (const char *fmt, ...)
22
{
23
  va_list arg;
24
  char *p;
25
  aligned i;
26
  int size;
27
  double x;
28
 
29
  va_start (arg, fmt);
30
  size = va_arg (arg, int);
31
  if (size != 5)
32
    abort ();
33
  p = __builtin_alloca (size + 1);
34
 
35
  x = va_arg (arg, double);
36
  if (x != 5.0)
37
    abort ();
38
 
39
  bar (p, size);
40
  if (__builtin_strncmp (p, "good", size) != 0)
41
    {
42
#ifdef DEBUG
43
      p[size] = '\0';
44
      printf ("Failed: %s != good\n", p);
45
#endif
46
      abort ();
47
    }
48
 
49
  if (check_int (&i,  __alignof__(i)) != i)
50
    abort ();
51
  va_end (arg);
52
}
53
 
54
int
55
main()
56
{
57
  foo ("foo", 5, 5.0);
58
  return 0;
59
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.