• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- main.c --------------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #include <setjmp.h>
10 #include <stdio.h>
11 #include <time.h>
12 
13 jmp_buf j;
14 
do_jump(void)15 void do_jump(void)
16 {
17     // We can't let the compiler know this will always happen or it might make
18     // optimizations that break our test.
19     if (!clock())
20         longjmp(j, 1); // non-local goto
21 }
22 
main(void)23 int main (void)
24 {
25     if (setjmp(j) == 0)
26         do_jump();
27     else
28         return 0; // destination of longjmp
29 
30     return 1;
31 }
32