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-alloca-1.C] - Blame information for rev 749

Go to most recent revision | 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 "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
class Base {};
21
 
22
struct A : virtual public Base
23
{
24
  A() {}
25
};
26
 
27
struct B {};
28
 
29
void
30
foo (int size) throw (B,A)
31
{
32
  char *p = (char*) __builtin_alloca (size + 1);
33
  aligned i;
34
 
35
  bar (p, size);
36
  if (__builtin_strncmp (p, "good", size) != 0)
37
    {
38
#ifdef DEBUG
39
      p[size] = '\0';
40
      printf ("Failed: %s != good\n", p);
41
#endif
42
      abort ();
43
    }
44
 
45
  if (check_int (&i,  __alignof__(i)) != i)
46
    abort ();
47
 
48
  throw A();
49
}
50
 
51
int
52
main()
53
{
54
  try { foo (5); }
55
  catch (A& a) { }
56
  return 0;
57
}

powered by: WebSVN 2.1.0

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