[RISC-V] Avoid unnecessary extensions when value is already extended
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / leak-pr109059-2.c
blob26329ffac46ff411e5c9467b96f0f3430d6b56b7
1 /* Reduced from haproxy-2.7.1's cfgparse.c. */
3 typedef __SIZE_TYPE__ size_t;
5 extern void*
6 calloc(size_t __nmemb, size_t __size)
7 __attribute__((__nothrow__, __leaf__))
8 __attribute__((__malloc__)) __attribute__((__alloc_size__(1, 2)));
10 struct list
12 struct list* n;
13 struct list* p;
16 struct cfg_postparser
18 struct list list;
19 char* name;
22 extern struct list postparsers;
24 int
25 test_1 (char* name)
27 struct cfg_postparser* cp;
29 cp = (struct cfg_postparser*) calloc(1, sizeof(*cp));
30 if (!cp) {
31 /* [...snip...] */
32 return 0;
34 cp->name = name;
36 (&cp->list)->p = (&postparsers)->p;
37 (&postparsers)->p = (&cp->list);
38 (&cp->list)->p->n = (&postparsers)->p;
39 (&cp->list)->n = (&postparsers);
41 return 1; /* { dg-bogus "leak of 'cp'" } */