2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr83312.c
blob2eb241dfdfe3a249f54cc80285840201edcd5c0b
1 /* { dg-options "-O2 -Warray-bounds" } */
3 struct ptlrpcd_ctl {
4 char pc_name[20];
5 };
6 struct ptlrpcd {
7 struct ptlrpcd_ctl pd_threads[6];
8 };
9 struct ptlrpcd *ptlrpcd_init_pd;
10 static void ptlrpcd_ctl_init(struct ptlrpcd_ctl *pc, int index) {
11 if (index < 0)
12 __builtin_snprintf(pc->pc_name, sizeof(pc->pc_name), "ptlrpcd_rcv");
13 else
14 __builtin_snprintf(pc->pc_name, sizeof(pc->pc_name), "ptlrpcd_%d", index);
16 int ptlrpcd_init_ncpts;
17 static int ptlrpcd_init(int nthreads) {
18 int j;
19 if (ptlrpcd_init_ncpts) {
20 ptlrpcd_ctl_init(&ptlrpcd_init_pd->pd_threads[0], -1);
21 for (j = 1; j < nthreads; j++)
22 ptlrpcd_ctl_init(&ptlrpcd_init_pd->pd_threads[j], j);
24 return 0;
26 int ptlrpcd_init_groupsize;
27 void ptlrpcd_addref(void) {
28 ptlrpcd_init(ptlrpcd_init_groupsize);