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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [sequence-pt-pr17880.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 jeremybenn
// PR 17880
2
// { dg-do compile }
3
// { dg-options "-Wsequence-point" }
4
 
5
int
6
foo (int x)
7
{
8
  unsigned int a;
9
  int b;
10
 
11
  b = (a += 5) > a;  // { dg-warning "undefined" "sequence point warning" }
12
  b = (a += 5) + a == 10;  // { dg-warning "undefined" "sequence point warning" }
13
  b = (a -= 5) > a;  // { dg-warning "undefined" "sequence point warning" }
14
  b = (a -= 5) + a == 10;  // { dg-warning "undefined" "sequence point warning" }
15
  b = a-- > a;  // { dg-warning "undefined" "sequence point warning" }
16
  b = a-- + a == 10;  // { dg-warning "undefined" "sequence point warning" }
17
  b = ++a > a;  // { dg-warning "undefined" "sequence point warning" }
18
  b = ++a + a == 10;  // { dg-warning "undefined" "sequence point warning" }
19
 
20
  if ((a += 5) > a) return -1;  // { dg-warning "undefined" "sequence point warning" }
21
  if ((a += 5) + a == 10) return -1;  // { dg-warning "undefined" "sequence point warning" }
22
  if ((a -= 5) > a) return -1;  // { dg-warning "undefined" "sequence point warning" }
23
  if ((a -= 5) + a == 10) return -1;  // { dg-warning "undefined" "sequence point warning" }
24
  if (a-- > a) return -1;  // { dg-warning "undefined" "sequence point warning" }
25
  if (a-- + a == 10) return -1;  // { dg-warning "undefined" "sequence point warning" }
26
  if (++a > a) return -1;  // { dg-warning "undefined" "sequence point warning" }
27
  if (++a + a == 10) return -1;  // { dg-warning "undefined" "sequence point warning" }
28
  do {} while ((a += 5) > a);  // { dg-warning "undefined" "sequence point warning" }
29
  while ((a += 5) > a);  // { dg-warning "undefined" "sequence point warning" }
30
  for ((a += 5) > a;;);  // { dg-warning "undefined" "sequence point warning" }
31
  for (b = (a += 5) > a;;);  // { dg-warning "undefined" "sequence point warning" }
32
  for (; (a += 5) > a;);  // { dg-warning "undefined" "sequence point warning" }
33
  for (;; b = (a += 5) > a);  // { dg-warning "undefined" "sequence point warning" }
34
  for (;; a++ + a++);  // { dg-warning "undefined" "sequence point warning" }
35
  if (a) a++ - a--;    // { dg-warning "undefined" "sequence point warning" }
36
  ((a +=5) > a) ? a : b; // { dg-warning "undefined" "sequence point warning" }
37
  return (a++ - a--); // { dg-warning "undefined" "sequence point warning" }
38
}
39
 
40
void bar (int i)
41
{
42
  int a = i++ - i++; // { dg-warning "undefined" "sequence point warning" }
43
}
44
 
45
void baz (int i)
46
{
47
  switch (i++ + i++)  // { dg-warning "undefined" "sequence point warning" }
48
    {
49
    case 1:
50
      i++ - i++;  // { dg-warning "undefined" "sequence point warning" }
51
    case 2:
52
      break;
53
    }
54
}

powered by: WebSVN 2.1.0

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