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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [Wstrict-overflow-18.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
3
 
4
/* Don't warn about an overflow when folding i > 0.  The loop analysis
5
   should determine that i does not wrap.
6
 
7
   The test is really bogus, p->a - p->b can be larger than INT_MAX
8
   and thus i can very well wrap.  */
9
 
10
struct c { unsigned int a; unsigned int b; };
11
extern void bar (struct c *);
12
int
13
foo (struct c *p)
14
{
15
  int i;
16
  int sum = 0;
17
 
18
  for (i = 0; i < p->a - p->b; ++i)
19
    {
20
      if (i > 0)  /* { dg-bogus "warning" "" { xfail *-*-* } } */
21
        sum += 2;
22
      bar (p);
23
    }
24
  return sum;
25
}

powered by: WebSVN 2.1.0

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