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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [c99-fordecl-1.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Test for C99 declarations in for loops.  */
2
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3
/* { dg-do run } */
4
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
5
 
6
extern void abort (void);
7
extern void exit (int);
8
 
9
int
10
main (void)
11
{
12
  int j = 0;
13
  int i = -1;
14
  for (int i = 1; i <= 10; i++)
15
    j += i;
16
  if (j != 55)
17
    abort ();
18
  if (i != -1)
19
    abort ();
20
  j = 0;
21
  for (auto int i = 1; i <= 10; i++)
22
    j += i;
23
  if (j != 55)
24
    abort ();
25
  if (i != -1)
26
    abort ();
27
  j = 0;
28
  for (register int i = 1; i <= 10; i++)
29
    j += i;
30
  if (j != 55)
31
    abort ();
32
  if (i != -1)
33
    abort ();
34
  exit (0);
35
}

powered by: WebSVN 2.1.0

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