Bug path

test_1
‘test_1’: events 1-13
21 if (n > 10)
^
|
(1) following ‘true’ branch (when ‘n > 10’)...
22 ptr = (int *)malloc (sizeof (int) * n);
~~~~~~~~~~~~~~~~~~~~~~~~~
|
(2) ...to here
(3) allocated here
[...]
32 for (i = 0; i < n; i++)
~~~~~
|
(4) following ‘true’ branch (when ‘i < n’)...
(7) following ‘true’ branch (when ‘i < n’)...
(9) following ‘false’ branch (when ‘i >= n’)...
33 p[i] = i; /* { dg-warning "dereference of possibly-NULL" } */
~~~~~~~~
| |
| (6) assuming ‘ptr’ is non-NULL
(5) ...to here
(8) ...to here
34 for (i = 0; i < n; i++)
~~~~~ ~~~~~
| |
| (11) following ‘true’ branch (when ‘i < n’)...
(10) ...to here
35 sum += foo (p[i]); /* { dg-bogus "uninitialized" } */
~
|
(12) ...to here
[...]
41 return result; /* { dg-message "leak of 'p'|leak of 'ptr'" } */
~~~~~~
|
(13) ‘ptr’ leaks here; was allocated at (3)