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] - Rev 774

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

// { dg-do run }

#include <vector>

std::vector <int>
sequence(int l, int n)
{
  std::vector <int> ret;
  for(int i=n;i<=100;i++)
    {
      if(i%2==0)
        {
          if(l%i==i/2)
            {
              int init =l/i-i/2+1;
              if(init>=0)
                {
                  for(int j=0;j<i;j++)
                    {
                      ret.push_back(init);
                      init ++;
                    }
                  break;
                }
            }
        }
      else
        {
          if(l%i==0)
            {
              int init =l/i-i/2;
              if(init>=0)
                {
                  for(int j=0;j<i;j++)
                    {
                      ret.push_back(init);
                      init ++;
                    }
                  break;
                }
            }
        }
    }
  return ret;
}
extern "C" void abort (void);
int main()
{
  std::vector<int> res = sequence(18, 2);
  if (res.size () != 3
      || res[0] != 5
      || res[1] != 6
      || res[2] != 7)
    abort ();
  return 0;
}

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

powered by: WebSVN 2.1.0

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