summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20000313-1.c
blob: 578adafb369761dc7e444d06e2272e650348b2d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
   20000227-1.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

unsigned int buggy (unsigned int *param)
{
  unsigned int accu, zero = 0, borrow;
  accu    = - *param;
  borrow  = - (accu > zero);
  *param += accu;
  return borrow;
}

void
testTortureExecute (void)
{
  unsigned int param  = 1;
  unsigned int borrow = buggy (&param);

  if (param != 0)
    ASSERT (0);
  if (borrow + 1 != 0)
    ASSERT (0);
  return;
}