OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [20041106-1.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do run { target *-*-linux* *-*-solaris* } } */
2
/* { dg-options -O2 } */
3
 
4
#include <sys/types.h>
5
#include <sys/mman.h>
6
#include <unistd.h>
7
#include <stdlib.h>
8
 
9
struct S { long x __attribute__((packed)); }; /* { dg-warning "attribute ignored" "" { target default_packed } } */
10
volatile long sink;
11
 
12
void foo (struct S *s)
13
{
14
  sink = s->x;
15
}
16
 
17
int main ()
18
{
19
  size_t ps = getpagesize ();
20
  char *ptr, *page;
21
  struct S *s;
22
 
23
  ptr = malloc (3*ps);
24
  page = (char *)(((size_t)ptr + (ps - 1)) & -ps);
25
  munmap (page + ps, ps);
26
 
27
  s = (struct S *)(page + ps - sizeof(struct S));
28
  foo(s);
29
 
30
  return 0;
31
}

powered by: WebSVN 2.1.0

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