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-2.C] - Blame information for rev 715

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

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-options "-Wno-abi" {target arm_eabi} } */
2
/* { dg-do run } */
3
/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
4
 
5
#include 
6
#include "check.h"
7
 
8
#ifndef ALIGNMENT
9
#define ALIGNMENT       64
10
#endif
11
 
12
typedef int aligned __attribute__((aligned(ALIGNMENT)));
13
 
14
int global;
15
 
16
void
17
bar (char *p, int size)
18
{
19
  __builtin_strncpy (p, "good", size);
20
}
21
 
22
class Base {};
23
 
24
struct A : virtual public Base
25
{
26
  A() {}
27
};
28
 
29
struct B {};
30
 
31
void
32
test (va_list arg) throw (B,A)
33
{
34
  char *p;
35
  aligned i;
36
  int size;
37
  double x;
38
 
39
  size = va_arg (arg, int);
40
  if (size != 5)
41
    abort ();
42
 
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
 
65
void
66
foo (const char *fmt, ...)
67
{
68
  va_list arg;
69
  va_start (arg, fmt);
70
  test (arg);
71
  va_end (arg);
72
}
73
int
74
main()
75
{
76
  try { foo ("foo", 5, 5.0); }
77
  catch (A& a) { }
78
  return 0;
79
}

powered by: WebSVN 2.1.0

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