Home | History | Annotate | Download | only in jni
      1 /* { dg-do run } */
      2 
      3 #include "check.h"
      4 
      5 #ifndef ALIGNMENT
      6 #define ALIGNMENT	64
      7 #endif
      8 
      9 typedef int aligned __attribute__((aligned(ALIGNMENT)));
     10 
     11 int global;
     12 
     13 void
     14 bar (char *p, int size)
     15 {
     16   __builtin_strncpy (p, "good", size);
     17 }
     18 
     19 class Base {};
     20 
     21 struct A : virtual public Base
     22 {
     23   A() {}
     24 };
     25 
     26 struct B {};
     27 
     28 void
     29 foo (int size) throw (B,A)
     30 {
     31   char *p = (char*) __builtin_alloca (size + 1);
     32   aligned i;
     33 
     34   bar (p, size);
     35   if (__builtin_strncmp (p, "good", size) != 0)
     36     {
     37 #ifdef DEBUG
     38       p[size] = '\0';
     39       printf ("Failed: %s != good\n", p);
     40 #endif
     41       abort ();
     42     }
     43 
     44   if (check_int (&i,  __alignof__(i)) != i)
     45     abort ();
     46 
     47   throw A();
     48 }
     49 
     50 int
     51 main()
     52 {
     53   try {	foo (5); }
     54   catch (A& a) { }
     55   return 0;
     56 }
     57