summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/charset/builtin1.c
blob: 753049c96661f077f39beaf60d5dbd4d39491e21 (plain)
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
/* isdigit(c) can be optimized to ((unsigned)c) - '0' <= 9, but only if
   we know the correct value of '0'.  PR 18785.  */

/* { dg-do run } */
/* { dg-require-iconv "IBM1047" } */
/* { dg-options "-O2 -fno-inline -fexec-charset=IBM1047" } */

extern int isdigit(int);
extern void abort(void);

static int str1(void) { return '1'; }
static int strA(void) { return 'A'; }

int
main(void)
{
  if (!isdigit('1'))
    abort();
  if (isdigit('A'))
    abort();
  if (!isdigit(str1()))
    abort();
  if (isdigit(strA()))
    abort();
  return 0;
}