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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [abi/] [pragma-pack1.C] - Blame information for rev 706

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

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/7046
2
 
3
extern "C" int printf (const char *, ...);
4
 
5
#pragma pack(4)
6
 
7
template 
8
struct T
9
{
10
    char      x1;   /* Usually 3 padding bytes are added after x1 member. */
11
    int       x2;
12
};
13
 
14
template 
15
int f()
16
{
17
  struct A { char i1; int i2; };
18
  return sizeof (A);
19
}
20
 
21
#pragma pack(1)
22
template struct T;   /* T is instantiated here */
23
template int f();
24
 
25
#pragma pack(4)
26
template struct T; /* T is required here */
27
template int f();
28
 
29
int main()
30
{
31
  printf("sizeof T   = %d\n", sizeof(T));
32
  printf("sizeof T = %d\n", sizeof(T));
33
  printf("f()        = %d\n", f());
34
  printf("f()      = %d\n", f());
35
  return (sizeof(T) != sizeof(T)
36
          || f() != f());
37
}

powered by: WebSVN 2.1.0

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