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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [torture/] [stackalign/] [eh-vararg-1.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-do run } */
2
/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
3
 
4
#include 
5
#include "check.h"
6
 
7
#ifndef ALIGNMENT
8
#define ALIGNMENT       64
9
#endif
10
 
11
typedef int aligned __attribute__((aligned(ALIGNMENT)));
12
 
13
int global;
14
 
15
void
16
bar (char *p, int size)
17
{
18
  __builtin_strncpy (p, "good", size);
19
}
20
 
21
class Base {};
22
 
23
struct A : virtual public Base
24
{
25
  A() {}
26
};
27
 
28
struct B {};
29
 
30
void
31
foo (const char *fmt, ...) throw (B,A)
32
{
33
  va_list arg;
34
  char *p;
35
  aligned i;
36
  int size;
37
  double x;
38
 
39
  va_start (arg, fmt);
40
  size = va_arg (arg, int);
41
  if (size != 5)
42
    abort ();
43
  p = (char *) __builtin_alloca (size + 1);
44
 
45
  x = va_arg (arg, double);
46
  if (x != 5.0)
47
    abort ();
48
 
49
  bar (p, size);
50
  if (__builtin_strncmp (p, "good", size) != 0)
51
    {
52
#ifdef DEBUG
53
      p[size] = '\0';
54
      printf ("Failed: %s != good\n", p);
55
#endif
56
      abort ();
57
    }
58
 
59
  if (check_int (&i,  __alignof__(i)) != i)
60
    abort ();
61
 
62
  throw A();
63
 
64
  va_end (arg);
65
}
66
 
67
int
68
main()
69
{
70
  try { foo ("foo", 5, 5.0); }
71
  catch (A& a) { }
72
  return 0;
73
}

powered by: WebSVN 2.1.0

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