aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/malloc-sarif-1.c
blob: 3d798e687e6f0d2d4960f91dc388df28db2508d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-additional-options "-fdiagnostics-format=sarif-file" } */

#include <stdlib.h>

void test_1 (void)
{
  void *ptr = malloc (1024);
  free (ptr);
  free (ptr);
}

/* Verify SARIF output.

     { dg-final { verify-sarif-file } }

   The threadFlowLocation objects should have "kinds" properties
   reflecting the meanings of the events:
     { dg-final { scan-sarif-file "\"kinds\": \\\[\"acquire\", \"memory\"\\\]" } }
     { dg-final { scan-sarif-file "\"kinds\": \\\[\"release\", \"memory\"\\\]" } }
     { dg-final { scan-sarif-file "\"kinds\": \\\[\"danger\"\\\]" } }
*/