aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/pr105783.c
blob: 34d21c62aef3cfa1817bfc3a351c6afeb3c12b6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* { dg-additional-options "-O" } */

struct ss_s {
    union out_or_counting_u {
    	char *newstr;
    	unsigned long long cnt;
    } uu;
    bool counting;
};

struct ss_s ss_init(void) {
   struct ss_s rr = { .counting = 1 };
   return rr;
}

void ss_out(struct ss_s *t, char cc) {
   if (!t->counting) {
       *t->uu.newstr++ = cc;
   }
}

int main() {
    struct ss_s ss = ss_init();
    ss_out(&ss, 'a');
}