brintos

brintos / llvm-project-archived public Read only

0
0
Text · 584 B · 4aebd9c Raw
31 lines · c
1// RUN: %gdb-compile 2>&1 | tee %t.compile2// RUN: %gdb-test -x %s.cmd %t 2>&1 | tee %t.out | FileCheck %s3 4#include <omp.h>5#include <stdio.h>6int get_fib_num(int num) {7  int t1, t2;8  if (num < 2)9    return num;10  else {11#pragma omp task shared(t1)12    t1 = get_fib_num(num - 1);13#pragma omp task shared(t2)14    t2 = get_fib_num(num - 2);15#pragma omp taskwait16    return t1 + t2;17  }18}19 20int main() {21  int ret = 0;22  omp_set_num_threads(2);23#pragma omp parallel24  { ret = get_fib_num(10); }25  printf("Fib of 10 is %d", ret);26  return 0;27}28 29// CHECK-NOT: Failed30// CHECK-NOT: Skip31