summaryrefslogtreecommitdiff
path: root/test/cfi/external-call.c
blob: f9cfabf7731b0c8d0f12b2bb551581bbbe3a9cfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: %clangxx_cfi -o %t1 %s
// RUN: %t1 c 1 2>&1 | FileCheck --check-prefix=CFI %s
// RUN: %t1 s 2 2>&1 | FileCheck --check-prefix=CFI %s

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

int main(int argc, char **argv) {
  // CFI: 1
  fprintf(stderr, "1\n");

  double (*fn)(double);
  if (argv[1][0] == 's')
    fn = sin;
  else
    fn = cos;

  fn(atof(argv[2]));

  // CFI: 2
  fprintf(stderr, "2\n");
}