summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c
blob: 6ca246d3922543b3c0d5566bc10296ec1a3aef3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Test for -fno-builtin-FUNCTION.  */
/* Origin: Joseph Myers <jsm28@cam.ac.uk>.  */
/* GCC normally handles abs and labs as built-in functions even without
   optimization.  So test that with -fno-builtin-abs, labs is so handled
   but abs isn't.  */

int abs_called = 0;

extern int abs (int);
extern long labs (long);
extern void abort (void);

void
main_test (void)
{
  if (labs (0) != 0)
    abort ();
  if (abs (0) != 0)
    abort ();
  if (!abs_called)
    abort ();
}