OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr46315.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* PR rtl-optimization/46315 */
2
/* Reported by Magnus Granberg <zorry@gentoo.org> */
3
 
4
/* { dg-do run } */
5
/* { dg-options "-O2 -fno-strict-overflow" } */
6
 
7
extern void abort (void);
8
 
9
static char const *
10
parse_ranged (char const *s, int digits)
11
{
12
  int n = 0;
13
  char const *lim = s + digits;
14
  while (s < lim)
15
    {
16
      unsigned d = *s++ - '0';
17
      if (9 < d)
18
        return 0;
19
      n = 10 * n + d;
20
    }
21
  return s && 0 <= n && n <= 59 ? s : 0;
22
}
23
 
24
int main(void)
25
{
26
  const char *s = "10092240";
27
 
28
  s = parse_ranged (s, 2);
29
  s = parse_ranged (s, 2);
30
  s = parse_ranged (s, 2);
31
  s = parse_ranged (s, 2);
32
 
33
  if (!s || *s != '\0')
34
    abort();
35
 
36
  return 0;
37
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.