comparison gcc/testsuite/gcc.dg/analyzer/compound-assignment-2.c @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
comparison
equal deleted inserted replaced
145:1830386684a0 152:2b5abeee2509
1 #include <stdlib.h>
2
3 struct array_wrapper
4 {
5 void *ptrs[2];
6 };
7
8 struct array_wrapper
9 test_1 (void)
10 {
11 struct array_wrapper aw1;
12 aw1.ptrs[0] = malloc (1024);
13 aw1.ptrs[1] = malloc (512);
14 return aw1;
15 }
16
17 struct array_wrapper
18 test_2 (void)
19 {
20 struct array_wrapper aw2;
21 aw2.ptrs[0] = malloc (1024);
22 aw2.ptrs[1] = malloc (512);
23 } /* { dg-warning "leak of 'aw2.ptrs.0.'" "leak of element 0" } */
24 /* { dg-warning "leak of 'aw2.ptrs.1.'" "leak of element 1" { target *-*-* } .-1 } */