1 /* PR middle-end/31309 */
2 /* Origin: Peeter Joot <peeterj@ca.ibm.com> */
4 /* { dg-do run { target *-*-linux* } } */
12 unsigned long ossAlignX(unsigned long i, unsigned long X)
14 return ((i + (X - 1)) & ~(unsigned long) (X - 1));
19 unsigned char slot[sizeof(unsigned short)];
20 unsigned char page[sizeof(unsigned int)];
23 struct SQLU_DICT_INFO_0
28 struct STRUCT_6_BYTES dRID;
31 struct SQLU_DATAPART_0
33 struct SQLU_DICT_INFO_0 *pDictRidderInfo;
38 struct SQLU_DATAPART_0 *m_pDatapart;
41 struct STRUCT_6_BYTES INIT_6_BYTES_ZERO()
43 struct STRUCT_6_BYTES ridOut = {{0,0}, {0,0,0,0}};
47 void Initialize(struct XXX *this, int iIndex)
49 struct SQLU_DICT_INFO_0 *pDictRidderInfo
50 = this->m_pDatapart[iIndex].pDictRidderInfo;
51 pDictRidderInfo->bSomeFlag1 = 0;
52 pDictRidderInfo->bSomeFlag2 = 0;
53 pDictRidderInfo->dRID = INIT_6_BYTES_ZERO();
62 char c0[4096-sizeof(struct XXX)];
64 char c1[4096*2-sizeof(struct SQLU_DATAPART_0)];
65 struct SQLU_DATAPART_0 dp;
66 char c2[4096*2-sizeof(struct SQLU_DICT_INFO_0)];
67 struct SQLU_DICT_INFO_0 di;
71 char buf[sizeof(struct stuff)+4096];
72 struct stuff *u = (struct stuff *)ossAlignX((unsigned long)&buf[0], 4096);
74 /* This test assumes system memory page size of 4096 bytes or less. */
75 if (sysconf(_SC_PAGESIZE) > 4096)
78 memset(u, 1, sizeof(struct stuff));
83 rc = mprotect(u->c1, 4096, PROT_NONE);
85 printf("mprotect:c1: %d: %d(%s)\n", rc, errno, strerror(errno));
87 rc = mprotect(u->c2, 4096, PROT_NONE);
89 printf("mprotect:c2: %d: %d(%s)\n", rc, errno, strerror(errno));
91 rc = mprotect(u->c3, 4096, PROT_NONE);
93 printf("mprotect:c3: %d: %d(%s)\n", rc, errno, strerror(errno));
95 u->o.m_pDatapart = &u->dp;
96 u->dp.pDictRidderInfo = &u->di;
99 mprotect(u->c1, 4096, PROT_READ|PROT_WRITE);
100 mprotect(u->c2, 4096, PROT_READ|PROT_WRITE);
101 mprotect(u->c3, 4096, PROT_READ|PROT_WRITE);