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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [stackalign/] [nested-3.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
3
 
4
#include "check.h"
5
 
6
#ifndef ALIGNMENT
7
#define ALIGNMENT       64
8
#endif
9
 
10
typedef int aligned __attribute__((aligned(ALIGNMENT)));
11
 
12
int global;
13
 
14
void
15
copy (char *p, int size)
16
{
17
  __builtin_strncpy (p, "good", size);
18
}
19
 
20
void
21
foo (int size)
22
{
23
  aligned j;
24
 
25
   __attribute__ ((__noinline__))
26
  void bar (int size)
27
    {
28
      char *p = __builtin_alloca (size + 1);
29
      aligned i;
30
 
31
      copy (p, size);
32
      if (strncmp (p, "good", size) != 0)
33
        {
34
#ifdef DEBUG
35
          p[size] = '\0';
36
          printf ("Failed: %s != good\n", p);
37
#endif
38
          abort ();
39
        }
40
 
41
      if (check_int (&i,  __alignof__(i)) != i)
42
        abort ();
43
 
44
      if (check_int (&j,  __alignof__(j)) != j)
45
        abort ();
46
 
47
      j = -20;
48
    }
49
  bar (size);
50
 
51
  if (j != -20)
52
    abort ();
53
 
54
  if (check_int (&j,  __alignof__(j)) != j)
55
    abort ();
56
}
57
 
58
int
59
main()
60
{
61
  foo (5);
62
  return 0;
63
}

powered by: WebSVN 2.1.0

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