111
|
1 /* PR middle-end/32758 */
|
|
2 /* HP-UX libunwind.so doesn't provide _UA_END_OF_STACK */
|
|
3 /* { dg-do run } */
|
|
4 /* { dg-options "-O2 -fexceptions" } */
|
|
5 /* { dg-skip-if "" { "ia64-*-hpux11.*" } } */
|
|
6 /* { dg-skip-if "" { ! nonlocal_goto } } */
|
145
|
7 /* { dg-require-effective-target exceptions } */
|
111
|
8 /* Verify unwind info in presence of alloca. */
|
|
9
|
|
10 #include <unwind.h>
|
|
11 #include <stdlib.h>
|
|
12 #include <string.h>
|
|
13
|
|
14 static _Unwind_Reason_Code
|
|
15 force_unwind_stop (int version, _Unwind_Action actions,
|
|
16 _Unwind_Exception_Class exc_class,
|
|
17 struct _Unwind_Exception *exc_obj,
|
|
18 struct _Unwind_Context *context,
|
|
19 void *stop_parameter)
|
|
20 {
|
|
21 if (actions & _UA_END_OF_STACK)
|
|
22 abort ();
|
|
23 return _URC_NO_REASON;
|
|
24 }
|
|
25
|
|
26 static void force_unwind (void)
|
|
27 {
|
|
28 struct _Unwind_Exception *exc = malloc (sizeof (*exc));
|
|
29 memset (&exc->exception_class, 0, sizeof (exc->exception_class));
|
|
30 exc->exception_cleanup = 0;
|
|
31
|
|
32 #ifndef __USING_SJLJ_EXCEPTIONS__
|
|
33 _Unwind_ForcedUnwind (exc, force_unwind_stop, 0);
|
|
34 #else
|
|
35 _Unwind_SjLj_ForcedUnwind (exc, force_unwind_stop, 0);
|
|
36 #endif
|
|
37
|
|
38 abort ();
|
|
39 }
|
|
40
|
|
41 __attribute__((noinline))
|
|
42 void foo (void *x __attribute__((unused)))
|
|
43 {
|
|
44 force_unwind ();
|
|
45 }
|
|
46
|
|
47 __attribute__((noinline))
|
|
48 int bar (unsigned int x)
|
|
49 {
|
|
50 void *y = __builtin_alloca (x);
|
|
51 foo (y);
|
|
52 return 1;
|
|
53 }
|
|
54
|
|
55 static void handler (void *p __attribute__((unused)))
|
|
56 {
|
|
57 exit (0);
|
|
58 }
|
|
59
|
|
60 __attribute__((noinline))
|
|
61 static void doit ()
|
|
62 {
|
|
63 char dummy __attribute__((cleanup (handler)));
|
|
64 bar (1024);
|
|
65 }
|
|
66
|
|
67 int main ()
|
|
68 {
|
|
69 doit ();
|
|
70 abort ();
|
|
71 }
|