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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.dg/] [compat/] [sdata-1_x.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
#include "sdata-section.h"
2
 
3
struct s { int x; int y[4]; };
4
extern struct s small_struct SDATA_SECTION;
5
 
6
/* Test "load address" operations.  */
7
int *xaddr (void) { return &small_struct.x; }
8
int *yaddr (int i) { return &small_struct.y[i]; }
9
 
10
void sdata_1_x (void)
11
{
12
  int i;
13
 
14
  /* Test direct accesses.  */
15
  small_struct.x = 5;
16
  for (i = 0; i < 4; i++)
17
    small_struct.y[i] = i + 42;
18
 
19
  if (*xaddr () != 5)
20
    abort ();
21
 
22
  for (i = 0; i < 4; i++)
23
    if (*yaddr (i) != i + 42)
24
      abort ();
25
}

powered by: WebSVN 2.1.0

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