summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20140212-2.c
blob: 36d4c1903e4ce3626d3553f7435f9bd90bcceabf (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
/*
   20140212-2.c from the execute part of the gcc torture suite.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

/* This used to fail as we would convert f into just return (unsigned int)usVlanID
   which is wrong. */

int f(unsigned short usVlanID);
int f(unsigned short usVlanID)
{
  unsigned int uiVlanID = 0xffffffff;
  if ((unsigned short)0xffff != usVlanID)
    uiVlanID = (unsigned int)usVlanID;
  return uiVlanID;
}

void
testTortureExecute (void)
{
  ASSERT (f(1) == 1);
  ASSERT (f(0xffff) == -1);
}