1 /* PR middle-end/31309 */
2 /* Origin: Peeter Joot <peeterj@ca.ibm.com> */
4 /* { dg-do run { target *-*-linux* } } */
11 unsigned long ossAlignX(unsigned long i
, unsigned long X
)
13 return ((i
+ (X
- 1)) & ~(unsigned long) (X
- 1));
18 unsigned char slot
[sizeof(unsigned short)];
19 unsigned char page
[sizeof(unsigned int)];
22 struct SQLU_DICT_INFO_0
27 struct STRUCT_6_BYTES dRID
;
30 struct SQLU_DATAPART_0
32 struct SQLU_DICT_INFO_0
*pDictRidderInfo
;
37 struct SQLU_DATAPART_0
*m_pDatapart
;
40 struct STRUCT_6_BYTES
INIT_6_BYTES_ZERO()
42 struct STRUCT_6_BYTES ridOut
= {{0,0}, {0,0,0,0}};
46 void Initialize(struct XXX
*this, int iIndex
)
48 struct SQLU_DICT_INFO_0
*pDictRidderInfo
49 = this->m_pDatapart
[iIndex
].pDictRidderInfo
;
50 pDictRidderInfo
->bSomeFlag1
= 0;
51 pDictRidderInfo
->bSomeFlag2
= 0;
52 pDictRidderInfo
->dRID
= INIT_6_BYTES_ZERO();
61 char c0
[4096-sizeof(struct XXX
)];
63 char c1
[4096*2-sizeof(struct SQLU_DATAPART_0
)];
64 struct SQLU_DATAPART_0 dp
;
65 char c2
[4096*2-sizeof(struct SQLU_DICT_INFO_0
)];
66 struct SQLU_DICT_INFO_0 di
;
70 char buf
[sizeof(struct stuff
)+4096];
71 struct stuff
*u
= (struct stuff
*)ossAlignX((unsigned long)&buf
[0], 4096);
72 memset(u
, 1, sizeof(struct stuff
));
77 rc
= mprotect(u
->c1
, 4096, PROT_NONE
);
79 printf("mprotect:c1: %d: %d(%s)\n", rc
, errno
, strerror(errno
));
81 rc
= mprotect(u
->c2
, 4096, PROT_NONE
);
83 printf("mprotect:c2: %d: %d(%s)\n", rc
, errno
, strerror(errno
));
85 rc
= mprotect(u
->c3
, 4096, PROT_NONE
);
87 printf("mprotect:c3: %d: %d(%s)\n", rc
, errno
, strerror(errno
));
89 u
->o
.m_pDatapart
= &u
->dp
;
90 u
->dp
.pDictRidderInfo
= &u
->di
;
93 mprotect(u
->c1
, 4096, PROT_READ
|PROT_WRITE
);
94 mprotect(u
->c2
, 4096, PROT_READ
|PROT_WRITE
);
95 mprotect(u
->c3
, 4096, PROT_READ
|PROT_WRITE
);