aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/scope-1.c
blob: f8acffa18e4124a46850fbbbfe183a5530275dbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdlib.h>

int test_1 (void)
{
  {
    int *q = malloc (1024);
  }

  return 42; /* { dg-warning "leak of 'q'" } */
  // FIXME: would be better to report it at the close-of-scope
}

int test_2 (void)
{
  {
    void *q = malloc (1024);
  }

  int q = 42;

  return q; /* { dg-warning "leak of 'q'" } */
  // FIXME: would be better to report it at the close-of-scope
}