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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [nest-align-1.c] - Blame information for rev 711

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

Line No. Rev Author Line
1 688 jeremybenn
/* Test for alignment handling when a variable is accessed by nested
2
   function.  */
3
/* Origin: Joey Ye <joey.ye@intel.com> */
4
 
5
#include <stddef.h>
6
 
7
typedef int aligned __attribute__((aligned));
8
extern void abort (void);
9
 
10
void
11
check (int *i)
12
{
13
  *i = 20;
14
  if ((((ptrdiff_t) i) & (__alignof__(aligned) - 1)) != 0)
15
    abort ();
16
}
17
 
18
void
19
foo (void)
20
{
21
  aligned jj;
22
  void bar ()
23
    {
24
      jj = -20;
25
    }
26
  jj = 0;
27
  bar ();
28
  if (jj != -20)
29
    abort ();
30
  check (&jj);
31
  if (jj != 20)
32
    abort ();
33
}
34
 
35
int
36
main()
37
{
38
  foo ();
39
  return 0;
40
}

powered by: WebSVN 2.1.0

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