blob: 3879311eb4527fb2e52398390f44893872141ceb [file] [log] [blame]
Ashok Thirumurthi0b009ee2013-07-15 15:05:33 +00001//===-- 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>
Ashok Thirumurthi23bb9472013-08-01 18:52:01 +000011#include <time.h>
Ashok Thirumurthi0b009ee2013-07-15 15:05:33 +000012
13jmp_buf j;
14
15void do_jump(void)
16{
Ashok Thirumurthi23bb9472013-08-01 18:52:01 +000017 // 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
Ashok Thirumurthi0b009ee2013-07-15 15:05:33 +000021}
22
23int main (void)
24{
25 if (setjmp(j) == 0)
26 do_jump();
27 else
28 return 0; // destination of longjmp
29
30 return 1;
31}