1 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
5 struct foo
{ int dummy
; };
12 if ((arr
= (struct foo
**)malloc(n
* sizeof(struct foo
*))) == NULL
)
15 for (i
= 0; i
< n
; i
++) {
16 if ((arr
[i
] = (struct foo
*)malloc(sizeof(struct foo
))) == NULL
) {
17 for (; i
>= 0; i
++) { /* { dg-warning "infinite loop" } */
18 /* This loop is in the wrong direction, so not technically an
19 infinite loop ("i" will eventually wrap around), but the
20 analyzer's condition handling treats the overflow as such.
21 In any case, the code is suspect and warrants a warning. */
22 free(arr
[i
]); /* { dg-bogus "double-'free'" } */
24 free(arr
); /* { dg-warning "leak" } */