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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [sequence-pt-2.c] - Blame information for rev 298

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

Line No. Rev Author Line
1 298 jeremybenn
/* More sequence point warning tests  */
2
/* { dg-do compile } */
3
/* { dg-options "-Wsequence-point" } */
4
 
5
struct s { struct s *nxt; int v; } q;
6
 
7
int x[10];
8
 
9
int foo(int *p)
10
{
11
  int i = 0;
12
 
13
  /* Test general-lvalue sequence point warnings  */
14
  (*p) = (*p)++; /* { dg-warning "undefined" "sequence point warning" } */
15
  p[3] = p[3]++; /* { dg-warning "undefined" "sequence point warning" } */
16
  p[i] = p[i]++; /* { dg-warning "undefined" "sequence point warning" } */
17
  x[3] = x[3]++; /* { dg-warning "undefined" "sequence point warning" } */
18
  q.nxt->nxt->v = q.nxt->nxt->v++; /* { dg-warning "undefined" "sequence point warning" } */
19
 
20
  /* test expressions that appear elsewhere in the C grammar */
21
 
22
  { int a = i-i++; (void)a;} /* { dg-warning "undefined" "sequence point warning" } */
23
 
24
  if ((i-i++) != 0) /* { dg-warning "undefined" "sequence point warning" } */
25
    return i-i++; /* { dg-warning "undefined" "sequence point warning" } */
26
 
27
  for (i-i++;;)  /* { dg-warning "undefined" "sequence point warning" } */
28
    ;
29
 
30
  for (; (i-i++) != 0; )  /* { dg-warning "undefined" "sequence point warning" } */
31
    ;
32
 
33
  for (;;i-i++)  /* { dg-warning "undefined" "sequence point warning" } */
34
    ;
35
 
36
  while ((i-i++) != 0)  /* { dg-warning "undefined" "sequence point warning" } */
37
    ;
38
 
39
  do {} while ((i-i++) != 0);  /* { dg-warning "undefined" "sequence point warning" } */
40
 
41
  switch (i-i++) {  /* { dg-warning "undefined" "sequence point warning" } */
42
  case 0: return 1;
43
  }
44
 
45
  return 0;
46
}

powered by: WebSVN 2.1.0

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