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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.dg/] [tree-ssa/] [pr18178.C] - Rev 12

Compare with Previous | Blame | View Log

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp" } */

// Define this to see it work.
// #define WORK_WORK_WORK

#define THIRD

#ifdef THIRD
#define FIRST  i < 0 || 
#define ORIG int
#define CAST
#else

#define FIRST
#ifdef WORK_WORK_WORK
#define ORIG unsigned int
#define CAST
#else
#define ORIG int
#define CAST (unsigned)
#endif // WORK_WORK_WORK

#endif // THIRD

struct array
{
  const ORIG len;
  int *data;
};

extern void call (ORIG);

void doit (array *a)
{
  for (ORIG i = 0; i < a->len; ++i)
    {
      if (FIRST  CAST (i) >= CAST (a->len))
        throw 5;
      call (a->data[i]);
    }
}

/* VRP should remove all but 1 if() in the loop.  */

/* { dg-final { scan-tree-dump-times "if " 1 "vrp"} } */
/* { dg-final { cleanup-tree-dump "vrp" } } */

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.