aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/pr61325.c
blob: 45ece53446f4592715177a9510e2d00ec458bf37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* { dg-do compile } */
/* { dg-options "-O2" } */
typedef unsigned int wchar_t;
typedef long unsigned int size_t;

size_t
wcstombs(char *s , const wchar_t *pwcs , size_t n)
{
  int count = 0;
  
  if (n != 0) {
    do {
      if ((*s++ = (char) *pwcs++) == 0)
        break;
      count++;
    } while (--n != 0);
  }
  return count;
}