| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options " -fno-diagnostics-json-formatting -fdiagnostics-format=sarif-file" } */ |
| 3 |
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ |
| 4 |
|
| 5 |
#include <stdlib.h> |
| 6 |
|
| 7 |
void test_1 (void) |
| 8 |
{ |
| 9 |
void *ptr = malloc (1024); |
| 10 |
free (ptr); |
| 11 |
free (ptr); |
| 12 |
} |
| 13 |
|
| 14 |
/* Verify SARIF output. |
| 15 |
|
| 16 |
{ dg-final { verify-sarif-file } } |
| 17 |
|
| 18 |
The threadFlowLocation objects should have "kinds" properties |
| 19 |
reflecting the meanings of the events: |
| 20 |
{ dg-final { scan-sarif-file "\"kinds\": \\\[\"acquire\", \"memory\"\\\]" } } |
| 21 |
{ dg-final { scan-sarif-file "\"kinds\": \\\[\"release\", \"memory\"\\\]" } } |
| 22 |
{ dg-final { scan-sarif-file "\"kinds\": \\\[\"danger\"\\\]" } } |
| 23 |
*/ |