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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 688 jeremybenn
/* Copyright (C) 2000 Free Software Foundation, Inc.
2
   Contributed by Nathan Sidwell 23 Feb 2000 <nathan@codesourcery.com> */
3
 
4
/* __alignof__ should never return a non-power of 2
5
   eg, sizeof(long double) might be 12, but that means it must be alignable
6
   on a 4 byte boundary. */
7
 
8
void check (char const *type, int align)
9
{
10
  if ((align & -align) != align)
11
    {
12
      abort ();
13
    }
14
}
15
 
16
#define QUOTE_(s) #s
17
#define QUOTE(s) QUOTE_(s)
18
 
19
#define check(t) check(QUOTE(t), __alignof__(t))
20
 
21
// This struct should have an alignment of the lcm of all the types. If one of
22
// the base alignments is not a power of two, then A cannot be power of two
23
// aligned.
24
struct A
25
{
26
  char c;
27
  signed short ss;
28
  unsigned short us;
29
  signed int si;
30
  unsigned int ui;
31
  signed long sl;
32
  unsigned long ul;
33
  signed long long sll;
34
  unsigned long long ull;
35
  float f;
36
  double d;
37
  long double ld;
38
  void *dp;
39
  void (*fp)();
40
};
41
 
42
int main ()
43
{
44
  check (void);
45
  check (char);
46
  check (signed short);
47
  check (unsigned short);
48
  check (signed int);
49
  check (unsigned int);
50
  check (signed long);
51
  check (unsigned long);
52
  check (signed long long);
53
  check (unsigned long long);
54
  check (float);
55
  check (double);
56
  check (long double);
57
  check (void *);
58
  check (void (*)());
59
  check (struct A);
60
  return 0;
61
}

powered by: WebSVN 2.1.0

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