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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libffi/] [testsuite/] [libffi.special/] [unwindtest_ffi_call.cc] - Blame information for rev 750

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

Line No. Rev Author Line
1 732 jeremybenn
/* Area:        ffi_call, unwind info
2
   Purpose:     Check if the unwind information is passed correctly.
3
   Limitations: none.
4
   PR:          none.
5
   Originator:  Andreas Tobler <andreast@gcc.gnu.org> 20061213  */
6
 
7
/* { dg-do run } */
8
#include "ffitestcxx.h"
9
 
10
static int checking(int a __UNUSED__, short b __UNUSED__,
11
                    signed char c __UNUSED__)
12
{
13
  throw 9;
14
}
15
 
16
int main (void)
17
{
18
  ffi_cif cif;
19
  ffi_type *args[MAX_ARGS];
20
  void *values[MAX_ARGS];
21
  ffi_arg rint;
22
 
23
  signed int si;
24
  signed short ss;
25
  signed char sc;
26
 
27
  args[0] = &ffi_type_sint;
28
  values[0] = &si;
29
  args[1] = &ffi_type_sshort;
30
  values[1] = &ss;
31
  args[2] = &ffi_type_schar;
32
  values[2] = &sc;
33
 
34
  /* Initialize the cif */
35
  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
36
                     &ffi_type_sint, args) == FFI_OK);
37
 
38
  si = -6;
39
  ss = -12;
40
  sc = -1;
41
  {
42
    try
43
      {
44
        ffi_call(&cif, FFI_FN(checking), &rint, values);
45
      } catch (int exception_code)
46
      {
47
        CHECK(exception_code == 9);
48
      }
49
    printf("part one OK\n");
50
    /* { dg-output "part one OK" } */
51
  }
52
  exit(0);
53
}

powered by: WebSVN 2.1.0

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