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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [torture/] [pr39417.C] - Blame information for rev 774

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
 
3
#include 
4
 
5
std::vector 
6
sequence(int l, int n)
7
{
8
  std::vector  ret;
9
  for(int i=n;i<=100;i++)
10
    {
11
      if(i%2==0)
12
        {
13
          if(l%i==i/2)
14
            {
15
              int init =l/i-i/2+1;
16
              if(init>=0)
17
                {
18
                  for(int j=0;j
19
                    {
20
                      ret.push_back(init);
21
                      init ++;
22
                    }
23
                  break;
24
                }
25
            }
26
        }
27
      else
28
        {
29
          if(l%i==0)
30
            {
31
              int init =l/i-i/2;
32
              if(init>=0)
33
                {
34
                  for(int j=0;j
35
                    {
36
                      ret.push_back(init);
37
                      init ++;
38
                    }
39
                  break;
40
                }
41
            }
42
        }
43
    }
44
  return ret;
45
}
46
extern "C" void abort (void);
47
int main()
48
{
49
  std::vector res = sequence(18, 2);
50
  if (res.size () != 3
51
      || res[0] != 5
52
      || res[1] != 6
53
      || res[2] != 7)
54
    abort ();
55
  return 0;
56
}

powered by: WebSVN 2.1.0

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