29 | PyList_Append(list, item);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
'demo': events 1-3
- |
- | 25 | list = PyList_New(0);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) when 'PyList_New' fails, returning NULL
- | 26 |
- | 27 | for (i = 0; i < count; i++) {
- | | ~~~
- | | |
- | | (2) when 'i < count'
- | 28 | item = PyLong_FromLong(random());
- | 29 | PyList_Append(list, item);
- | | ~~~~~~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
- |
+ 25 | list = PyList_New(0);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) when 'PyList_New' fails, returning NULL
+ 26 |
+ 27 | for (i = 0; i < count; i++) {
+ | ~~~
+ | |
+ | (2) when 'i < count'
+ 28 | item = PyLong_FromLong(random());
+ 29 | PyList_Append(list, item);
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
The diagnostic-printing code has consolidated the path into a single
run of events, since all the events are near each other and within the same
virtual tree get_fndecl () const = 0;
- /* Stack depth, so that consumers can visualizes the interprocedural
+ /* Stack depth, so that consumers can visualize the interprocedural
calls, returns, and frame nesting. */
virtual int get_stack_depth () const = 0;
@smallexample
'test': events 1-3
- |
- | 25 | list = PyList_New(0);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) when 'PyList_New' fails, returning NULL
- | 26 |
- | 27 | for (i = 0; i < count; i++) @{
- | | ~~~
- | | |
- | | (2) when 'i < count'
- | 28 | item = PyLong_FromLong(random());
- | 29 | PyList_Append(list, item);
- | | ~~~~~~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
- |
+ 25 | list = PyList_New(0);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) when 'PyList_New' fails, returning NULL
+ 26 |
+ 27 | for (i = 0; i < count; i++) @{
+ | ~~~
+ | |
+ | (2) when 'i < count'
+ 28 | item = PyLong_FromLong(random());
+ 29 | PyList_Append(list, item);
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
@end smallexample
Interprocedural control flow is shown by grouping the events by stack frame,
int32_t *ptr = (int32_t *) __builtin_malloc (1);
^~~~~~~~~~~~~~~~~~~~
'test_constant_1': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_malloc (1);
- | ^~~~~~~~~~~~~~~~~~~~
- | |
- | (1) allocated 1 byte here
- | (2) assigned to 'int32_t *'
- |
+ int32_t *ptr = (int32_t *) __builtin_malloc (1);
+ ^~~~~~~~~~~~~~~~~~~~
+ |
+ (1) allocated 1 byte here
+ (2) assigned to 'int32_t *'
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
int32_t *ptr = (int32_t *) __builtin_malloc (1);
~~~~~~~~~~~~~~~~~^~~
'void test_constant_1()': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_malloc (1);
- | ~~~~~~~~~~~~~~~~~^~~
- | |
- | (1) allocated 1 byte here
- | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) __builtin_malloc (1);
+ ~~~~~~~~~~~~~~~~~^~~
+ |
+ (1) allocated 1 byte here
+ (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c++ } } */
void test_constant_2 (void)
int32_t *ptr = (int32_t *) __builtin_malloc (2);
^~~~~~~~~~~~~~~~~~~~
'test_constant_2': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_malloc (2);
- | ^~~~~~~~~~~~~~~~~~~~
- | |
- | (1) allocated 2 bytes here
- | (2) assigned to 'int32_t *'
- |
+ int32_t *ptr = (int32_t *) __builtin_malloc (2);
+ ^~~~~~~~~~~~~~~~~~~~
+ |
+ (1) allocated 2 bytes here
+ (2) assigned to 'int32_t *'
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
int32_t *ptr = (int32_t *) __builtin_malloc (2);
~~~~~~~~~~~~~~~~~^~~
'void test_constant_2()': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_malloc (2);
- | ~~~~~~~~~~~~~~~~~^~~
- | |
- | (1) allocated 2 bytes here
- | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) __builtin_malloc (2);
+ ~~~~~~~~~~~~~~~~~^~~
+ |
+ (1) allocated 2 bytes here
+ (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c++ } } */
void test_symbolic (int n)
int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
^~~~~~~~~~~~~~~~~~~~~~~~
'test_symbolic': event 1
- |
- | int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
- | ^~~~~~~~~~~~~~~~~~~~~~~~
- | |
- | (1) allocated 'n * 2' bytes and assigned to 'int32_t *'
- |
+ int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
+ ^~~~~~~~~~~~~~~~~~~~~~~~
+ |
+ (1) allocated 'n * 2' bytes and assigned to 'int32_t *'
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
~~~~~~~~~~~~~~~~~^~~~~~~
'void test_symbolic(int)': event 1
- |
- | int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
- | ~~~~~~~~~~~~~~~~~^~~~~~~
- | |
- | (1) allocated '(n * 2)' bytes and assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
+ ~~~~~~~~~~~~~~~~~^~~~~~~
+ |
+ (1) allocated '(n * 2)' bytes and assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c++ } } */
int32_t *ptr = (int32_t *) __builtin_alloca (1);
^~~~~~~~~~~~~~~~~~~~
'test_constant_1': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_alloca (1);
- | ^~~~~~~~~~~~~~~~~~~~
- | |
- | (1) allocated 1 byte here
- | (2) assigned to 'int32_t *'
- |
+ int32_t *ptr = (int32_t *) __builtin_alloca (1);
+ ^~~~~~~~~~~~~~~~~~~~
+ |
+ (1) allocated 1 byte here
+ (2) assigned to 'int32_t *'
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
int32_t *ptr = (int32_t *) __builtin_alloca (1);
~~~~~~~~~~~~~~~~~^~~
'void test_constant_1()': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_alloca (1);
- | ~~~~~~~~~~~~~~~~~^~~
- | |
- | (1) allocated 1 byte here
- | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) __builtin_alloca (1);
+ ~~~~~~~~~~~~~~~~~^~~
+ |
+ (1) allocated 1 byte here
+ (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c++ } } */
void test_constant_2 (void)
int32_t *ptr = (int32_t *) __builtin_alloca (2);
^~~~~~~~~~~~~~~~~~~~
'test_constant_2': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_alloca (2);
- | ^~~~~~~~~~~~~~~~~~~~
- | |
- | (1) allocated 2 bytes here
- | (2) assigned to 'int32_t *'
- |
+ int32_t *ptr = (int32_t *) __builtin_alloca (2);
+ ^~~~~~~~~~~~~~~~~~~~
+ |
+ (1) allocated 2 bytes here
+ (2) assigned to 'int32_t *'
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
int32_t *ptr = (int32_t *) __builtin_alloca (2);
~~~~~~~~~~~~~~~~~^~~
'void test_constant_2()': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_alloca (2);
- | ~~~~~~~~~~~~~~~~~^~~
- | |
- | (1) allocated 2 bytes here
- | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) __builtin_alloca (2);
+ ~~~~~~~~~~~~~~~~~^~~
+ |
+ (1) allocated 2 bytes here
+ (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c++ } } */
void test_symbolic (int n)
int32_t *ptr = (int32_t *) __builtin_alloca (n * 2);
^~~~~~~~~~~~~~~~~~~~~~~~
'test_symbolic': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_alloca (n * 2);
- | ^~~~~~~~~~~~~~~~~~~~~~~~
- | |
- | (1) allocated 'n * 2' bytes here
- | (2) assigned to 'int32_t *'
- |
+ int32_t *ptr = (int32_t *) __builtin_alloca (n * 2);
+ ^~~~~~~~~~~~~~~~~~~~~~~~
+ |
+ (1) allocated 'n * 2' bytes here
+ (2) assigned to 'int32_t *'
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
int32_t *ptr = (int32_t *) __builtin_alloca (n * 2);
~~~~~~~~~~~~~~~~~^~~~~~~
'void test_symbolic(int)': events 1-2
- |
- | int32_t *ptr = (int32_t *) __builtin_alloca (n * 2);
- | ~~~~~~~~~~~~~~~~~^~~~~~~
- | |
- | (1) allocated '(n * 2)' bytes here
- | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) __builtin_alloca (n * 2);
+ ~~~~~~~~~~~~~~~~~^~~~~~~
+ |
+ (1) allocated '(n * 2)' bytes here
+ (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c++ } } */
/* FIXME: am getting a duplicate warning here for some reason
int32_t *ptr = (int32_t *) alloca (99);
^~~~~~
'test_constant_99': events 1-2
- |
- | int32_t *ptr = (int32_t *) alloca (99);
- | ^~~~~~
- | |
- | (1) allocated 99 bytes here
- | (2) assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) alloca (99);
+ ^~~~~~
+ |
+ (1) allocated 99 bytes here
+ (2) assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
int32_t *ptr = (int32_t *) alloca (99);
^~~~~~
'void test_constant_99()': events 1-2
- |
- | int32_t *ptr = (int32_t *) alloca (99);
- | ^~~~~~
- | |
- | (1) allocated 99 bytes here
- | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) alloca (99);
+ ^~~~~~
+ |
+ (1) allocated 99 bytes here
+ (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c++ } } */
void test_symbolic (int n)
int32_t *ptr = (int32_t *) alloca (n * 2);
^~~~~~
'test_symbolic': events 1-2
- |
- | int32_t *ptr = (int32_t *) alloca (n * 2);
- | ^~~~~~
- | |
- | (1) allocated 'n * 2' bytes here
- | (2) assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) alloca (n * 2);
+ ^~~~~~
+ |
+ (1) allocated 'n * 2' bytes here
+ (2) assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
int32_t *ptr = (int32_t *) alloca (n * 2);
^~~~~~
'void test_symbolic(int)': events 1-2
- |
- | int32_t *ptr = (int32_t *) alloca (n * 2);
- | ^~~~~~
- | |
- | (1) allocated '(n * 2)' bytes here
- | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
- |
+ int32_t *ptr = (int32_t *) alloca (n * 2);
+ ^~~~~~
+ |
+ (1) allocated '(n * 2)' bytes here
+ (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
{ dg-end-multiline-output "" { target c++ } } */
NN | free (ptr);
| ^~~~~~~~~~
'test_3': events 1-2
- |
- | NN | free (ptr);
- | | ^~~~~~~~~~
- | | |
- | | (1) first 'free' here
- | NN | called_by_test_3 ();
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- |
+ NN | free (ptr);
+ | ^~~~~~~~~~
+ | |
+ | (1) first 'free' here
+ NN | called_by_test_3 ();
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | free (ptr);
| ~~~~~^~~~~
'void test_3(void*)': events 1-2
- |
- | NN | free (ptr);
- | | ~~~~~^~~~~
- | | |
- | | (1) first 'free' here
- | NN | called_by_test_3 ();
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- |
+ NN | free (ptr);
+ | ~~~~~^~~~~
+ | |
+ | (1) first 'free' here
+ NN | called_by_test_3 ();
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
{ dg-end-multiline-output "" { target c++ } } */
NN | free (ptr);
| ^~~~~~~~~~
'test_3': events 1-2
- |
- | NN | free (ptr);
- | | ^~~~~~~~~~
- | | |
- | | (1) first 'free' here
- | NN | called_by_test_3 ();
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- |
+ NN | free (ptr);
+ | ^~~~~~~~~~
+ | |
+ | (1) first 'free' here
+ NN | called_by_test_3 ();
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | free (ptr);
| ~~~~~^~~~~
'void test_3(void*)': events 1-2
- |
- | NN | free (ptr);
- | | ~~~~~^~~~~
- | | |
- | | (1) first 'free' here
- | NN | called_by_test_3 ();
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- |
+ NN | free (ptr);
+ | ~~~~~^~~~~
+ | |
+ | (1) first 'free' here
+ NN | called_by_test_3 ();
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
{ dg-end-multiline-output "" { target c++ } } */
NN | free (ptr);
| ^~~~~~~~~~
'test_3': events 1-2
- |
- | NN | free (ptr);
- | | ^~~~~~~~~~
- | | |
- | | (1) first 'free' here
- | NN | called_by_test_3 ();
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- |
+ NN | free (ptr);
+ | ^~~~~~~~~~
+ | |
+ | (1) first 'free' here
+ NN | called_by_test_3 ();
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | free (ptr);
| ~~~~~^~~~~
'void test_3(void*)': events 1-2
- |
- | NN | free (ptr);
- | | ~~~~~^~~~~
- | | |
- | | (1) first 'free' here
- | NN | called_by_test_3 ();
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- |
+ NN | free (ptr);
+ | ~~~~~^~~~~
+ | |
+ | (1) first 'free' here
+ NN | called_by_test_3 ();
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
{ dg-end-multiline-output "" { target c++ } } */
NN | free (ptr);
| ^~~~~~~~~~
'test_3': events 1-2
- |
- | NN | free (ptr);
- | | ^~~~~~~~~~
- | | |
- | | (1) first 'free' here
- | NN | called_by_test_3 ();
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- |
+ NN | free (ptr);
+ | ^~~~~~~~~~
+ | |
+ | (1) first 'free' here
+ NN | called_by_test_3 ();
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | free (ptr);
| ~~~~~^~~~~
'void test_3(void*)': events 1-2
- |
- | NN | free (ptr);
- | | ~~~~~^~~~~
- | | |
- | | (1) first 'free' here
- | NN | called_by_test_3 ();
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- |
+ NN | free (ptr);
+ | ~~~~~^~~~~
+ | |
+ | (1) first 'free' here
+ NN | called_by_test_3 ();
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
{ dg-end-multiline-output "" { target c++ } } */
| ^~~~~~~~~
NN | WRAPPED_FREE (ptr);
| ^~~~~~~~~~~~
- 'test': event 1
- |
- |
- | NN | #define WRAPPED_FREE(PTR) free(PTR)
- | | ^~~~~~~~~
- | | |
- | | (1) first 'free' here
- | NN | WRAPPED_FREE (ptr);
- | | ^~~~~~~~~~~~
- |
- 'test': event 2
- |
- |
- | NN | #define WRAPPED_FREE(PTR) free(PTR)
- | | ^~~~~~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- | NN | WRAPPED_FREE (ptr);
- | | ^~~~~~~~~~~~
- |
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | #define WRAPPED_FREE(PTR) free(PTR)
| ~~~~^~~~~
NN | WRAPPED_FREE (ptr);
| ^~~~~~~~~~~~
+ { dg-end-multiline-output "" { target c++ } } */
+ /* { dg-begin-multiline-output "" }
+ 'test': event 1
+ { dg-end-multiline-output "" { target c } } */
+ /* { dg-begin-multiline-output "" }
'void test(void*)': event 1
- |
- |
- | NN | #define WRAPPED_FREE(PTR) free(PTR)
- | | ~~~~^~~~~
- | | |
- | | (1) first 'free' here
- | NN | WRAPPED_FREE (ptr);
- | | ^~~~~~~~~~~~
- |
+ { dg-end-multiline-output "" { target c++ } } */
+ /* { dg-prune-output "\[^\n\r\]*malloc-macro.h\[^\n\r\]*" } */
+ /* { dg-begin-multiline-output "" }
+ NN | #define WRAPPED_FREE(PTR) free(PTR)
+ | ^~~~~~~~~
+ | |
+ | (1) first 'free' here
+ NN | WRAPPED_FREE (ptr);
+ | ^~~~~~~~~~~~
+ { dg-end-multiline-output "" { target c } } */
+ /* { dg-begin-multiline-output "" }
+ NN | #define WRAPPED_FREE(PTR) free(PTR)
+ | ~~~~^~~~~
+ | |
+ | (1) first 'free' here
+ NN | WRAPPED_FREE (ptr);
+ | ^~~~~~~~~~~~
+ { dg-end-multiline-output "" { target c++ } } */
+ /* { dg-prune-output "\[^\n\r\]*malloc-macro.h\[^\n\r\]*" } */
+ /* { dg-begin-multiline-output "" }
+ 'test': event 2
+ { dg-end-multiline-output "" { target c } } */
+ /* { dg-begin-multiline-output "" }
'void test(void*)': event 2
- |
- |
- | NN | #define WRAPPED_FREE(PTR) free(PTR)
- | | ~~~~^~~~~
- | | |
- | | (2) second 'free' here; first 'free' was at (1)
- | NN | WRAPPED_FREE (ptr);
- | | ^~~~~~~~~~~~
- |
+ { dg-end-multiline-output "" { target c++ } } */
+ /* { dg-prune-output "\[^\n\r\]*malloc-macro.h\[^\n\r\]*" } */
+ /* { dg-begin-multiline-output "" }
+ NN | #define WRAPPED_FREE(PTR) free(PTR)
+ | ^~~~~~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
+ NN | WRAPPED_FREE (ptr);
+ | ^~~~~~~~~~~~
+ { dg-end-multiline-output "" { target c } } */
+ /* { dg-begin-multiline-output "" }
+ NN | #define WRAPPED_FREE(PTR) free(PTR)
+ | ~~~~^~~~~
+ | |
+ | (2) second 'free' here; first 'free' was at (1)
+ NN | WRAPPED_FREE (ptr);
+ | ^~~~~~~~~~~~
{ dg-end-multiline-output "" { target c++ } } */
}
NN | free (ptr);
| ^~~~~~~~~~
'test_1': events 1-3
- |
- | NN | void *ptr = malloc (1024);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) first 'free' here
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (3) second 'free' here; first 'free' was at (2)
- |
+ NN | void *ptr = malloc (1024);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) first 'free' here
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (3) second 'free' here; first 'free' was at (2)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | free (ptr);
| ~~~~~^~~~~
'void test_1()': events 1-3
- |
- | NN | void *ptr = malloc (1024);
- | | ~~~~~~~^~~~~~
- | | |
- | | (1) allocated here
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) first 'free' here
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (3) second 'free' here; first 'free' was at (2)
- |
+ NN | void *ptr = malloc (1024);
+ | ~~~~~~~^~~~~~
+ | |
+ | (1) allocated here
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) first 'free' here
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (3) second 'free' here; first 'free' was at (2)
{ dg-end-multiline-output "" { target c++ } } */
void test_2 (int x, int y)
NN | free (ptr);
| ^~~~~~~~~~
'test_2': events 1-7
- |
- | NN | void *ptr = malloc (1024);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | if (x)
- | | ~
- | | |
- | | (2) following 'true' branch (when 'x != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (3) ...to here
- | | (4) first 'free' here
- | NN | if (y)
- | | ~
- | | |
- | | (5) following 'true' branch (when 'y != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (6) ...to here
- | | (7) second 'free' here; first 'free' was at (4)
- |
+ NN | void *ptr = malloc (1024);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | if (x)
+ | ~
+ | |
+ | (2) following 'true' branch (when 'x != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (3) ...to here
+ | (4) first 'free' here
+ NN | if (y)
+ | ~
+ | |
+ | (5) following 'true' branch (when 'y != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (6) ...to here
+ | (7) second 'free' here; first 'free' was at (4)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | free (ptr);
| ~~~~~^~~~~
'void test_2(int, int)': events 1-7
- |
- | NN | void *ptr = malloc (1024);
- | | ~~~~~~~^~~~~~
- | | |
- | | (1) allocated here
- | NN | if (x)
- | | ~~
- | | |
- | | (2) following 'true' branch (when 'x != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (3) ...to here
- | | (4) first 'free' here
- | NN | if (y)
- | | ~~
- | | |
- | | (5) following 'true' branch (when 'y != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (6) ...to here
- | | (7) second 'free' here; first 'free' was at (4)
- |
+ NN | void *ptr = malloc (1024);
+ | ~~~~~~~^~~~~~
+ | |
+ | (1) allocated here
+ NN | if (x)
+ | ~~
+ | |
+ | (2) following 'true' branch (when 'x != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (3) ...to here
+ | (4) first 'free' here
+ NN | if (y)
+ | ~~
+ | |
+ | (5) following 'true' branch (when 'y != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (6) ...to here
+ | (7) second 'free' here; first 'free' was at (4)
{ dg-end-multiline-output "" { target c++ } } */
/* "leak of 'ptr'. */
NN | }
| ^
'test_2': events 1-6
- |
- | NN | void *ptr = malloc (1024);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | if (x)
- | | ~
- | | |
- | | (2) following 'false' branch (when 'x == 0')...
- | NN | free (ptr);
- | NN | if (y)
- | | ~
- | | |
- | | (3) ...to here
- | | (4) following 'false' branch (when 'y == 0')...
- | NN | free (ptr);
- | NN | }
- | | ~
- | | |
- | | (5) ...to here
- | | (6) 'ptr' leaks here; was allocated at (1)
- |
+ NN | void *ptr = malloc (1024);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | if (x)
+ | ~
+ | |
+ | (2) following 'false' branch (when 'x == 0')...
+ NN | free (ptr);
+ NN | if (y)
+ | ~
+ | |
+ | (3) ...to here
+ | (4) following 'false' branch (when 'y == 0')...
+ NN | free (ptr);
+ NN | }
+ | ~
+ | |
+ | (5) ...to here
+ | (6) 'ptr' leaks here; was allocated at (1)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | }
| ^
'void test_2(int, int)': events 1-6
- |
- | NN | void *ptr = malloc (1024);
- | | ~~~~~~~^~~~~~
- | | |
- | | (1) allocated here
- | NN | if (x)
- | | ~~
- | | |
- | | (2) following 'false' branch (when 'x == 0')...
- | NN | free (ptr);
- | NN | if (y)
- | | ~~
- | | |
- | | (3) ...to here
- | | (4) following 'false' branch (when 'y == 0')...
- | NN | free (ptr);
- | NN | }
- | | ~
- | | |
- | | (5) ...to here
- | | (6) 'ptr' leaks here; was allocated at (1)
- |
+ NN | void *ptr = malloc (1024);
+ | ~~~~~~~^~~~~~
+ | |
+ | (1) allocated here
+ NN | if (x)
+ | ~~
+ | |
+ | (2) following 'false' branch (when 'x == 0')...
+ NN | free (ptr);
+ NN | if (y)
+ | ~~
+ | |
+ | (3) ...to here
+ | (4) following 'false' branch (when 'y == 0')...
+ NN | free (ptr);
+ NN | }
+ | ~
+ | |
+ | (5) ...to here
+ | (6) 'ptr' leaks here; was allocated at (1)
{ dg-end-multiline-output "" { target c++ } } */
int test_3 (int x, int y)
NN | *ptr = 42;
| ~~~~~^~~~
'test_3': events 1-2
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ^~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (1) this call could return NULL
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) 'ptr' could be NULL: unchecked value from (1)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ^~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (1) this call could return NULL
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) 'ptr' could be NULL: unchecked value from (1)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | *ptr = 42;
| ~~~~~^~~~
'int test_3(int, int)': events 1-2
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ~~~~~~~^~~~~~~~~~~~~~
- | | |
- | | (1) this call could return NULL
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) 'ptr' could be NULL: unchecked value from (1)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ~~~~~~~^~~~~~~~~~~~~~
+ | |
+ | (1) this call could return NULL
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) 'ptr' could be NULL: unchecked value from (1)
{ dg-end-multiline-output "" { target c++ } } */
/* "use after 'free' of 'ptr'". */
NN | *ptr = 19;
| ~~~~~^~~~
'test_3': events 1-6
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ^~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~
- | | |
- | | (3) following 'true' branch (when 'x != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (4) ...to here
- | | (5) freed here
- | NN |
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (6) use after 'free' of 'ptr'; freed at (5)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ^~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~
+ | |
+ | (3) following 'true' branch (when 'x != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (4) ...to here
+ | (5) freed here
+ NN |
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (6) use after 'free' of 'ptr'; freed at (5)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | *ptr = 19;
| ~~~~~^~~~
'int test_3(int, int)': events 1-6
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ~~~~~~~^~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~~
- | | |
- | | (3) following 'true' branch (when 'x != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (4) ...to here
- | | (5) freed here
- | NN |
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (6) use after 'free' of 'ptr'; freed at (5)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ~~~~~~~^~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~~
+ | |
+ | (3) following 'true' branch (when 'x != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (4) ...to here
+ | (5) freed here
+ NN |
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (6) use after 'free' of 'ptr'; freed at (5)
{ dg-end-multiline-output "" { target c++ } } */
/* "use after 'free' of 'ptr'". */
NN | return *ptr;
| ^~~~
'test_3': events 1-8
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ^~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~
- | | |
- | | (3) following 'false' branch (when 'x == 0')...
- |......
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (4) ...to here
- |......
- | NN | if (y)
- | | ~
- | | |
- | | (5) following 'true' branch (when 'y != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (6) ...to here
- | | (7) freed here
- | NN |
- | NN | return *ptr;
- | | ~~~~
- | | |
- | | (8) use after 'free' of 'ptr'; freed at (7)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ^~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~
+ | |
+ | (3) following 'false' branch (when 'x == 0')...
+......
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (4) ...to here
+......
+ NN | if (y)
+ | ~
+ | |
+ | (5) following 'true' branch (when 'y != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (6) ...to here
+ | (7) freed here
+ NN |
+ NN | return *ptr;
+ | ~~~~
+ | |
+ | (8) use after 'free' of 'ptr'; freed at (7)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | return *ptr;
| ^~~
'int test_3(int, int)': events 1-8
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ~~~~~~~^~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~~
- | | |
- | | (3) following 'false' branch (when 'x == 0')...
- |......
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (4) ...to here
- |......
- | NN | if (y)
- | | ~~
- | | |
- | | (5) following 'true' branch (when 'y != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (6) ...to here
- | | (7) freed here
- | NN |
- | NN | return *ptr;
- | | ~~~
- | | |
- | | (8) use after 'free' of 'ptr'; freed at (7)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ~~~~~~~^~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~~
+ | |
+ | (3) following 'false' branch (when 'x == 0')...
+......
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (4) ...to here
+......
+ NN | if (y)
+ | ~~
+ | |
+ | (5) following 'true' branch (when 'y != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (6) ...to here
+ | (7) freed here
+ NN |
+ NN | return *ptr;
+ | ~~~
+ | |
+ | (8) use after 'free' of 'ptr'; freed at (7)
{ dg-end-multiline-output "" { target c++ } } */
/* "leak of 'ptr'". */
NN | return *ptr;
| ^~~~
'test_3': events 1-7
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ^~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~
- | | |
- | | (3) following 'false' branch (when 'x == 0')...
- |......
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (4) ...to here
- |......
- | NN | if (y)
- | | ~
- | | |
- | | (5) following 'false' branch (when 'y == 0')...
- |......
- | NN | return *ptr;
- | | ~~~~
- | | |
- | | (6) ...to here
- | | (7) 'ptr' leaks here; was allocated at (1)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ^~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~
+ | |
+ | (3) following 'false' branch (when 'x == 0')...
+......
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (4) ...to here
+......
+ NN | if (y)
+ | ~
+ | |
+ | (5) following 'false' branch (when 'y == 0')...
+......
+ NN | return *ptr;
+ | ~~~~
+ | |
+ | (6) ...to here
+ | (7) 'ptr' leaks here; was allocated at (1)
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | return *ptr;
| ^~~
'int test_3(int, int)': events 1-7
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ~~~~~~~^~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~~
- | | |
- | | (3) following 'false' branch (when 'x == 0')...
- |......
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (4) ...to here
- |......
- | NN | if (y)
- | | ~~
- | | |
- | | (5) following 'false' branch (when 'y == 0')...
- |......
- | NN | return *ptr;
- | | ~~~
- | | |
- | | (6) ...to here
- | | (7) 'ptr' leaks here; was allocated at (1)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ~~~~~~~^~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~~
+ | |
+ | (3) following 'false' branch (when 'x == 0')...
+......
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (4) ...to here
+......
+ NN | if (y)
+ | ~~
+ | |
+ | (5) following 'false' branch (when 'y == 0')...
+......
+ NN | return *ptr;
+ | ~~~
+ | |
+ | (6) ...to here
+ | (7) 'ptr' leaks here; was allocated at (1)
{ dg-end-multiline-output "" { target c++ } } */
NN | __analyzer_dump_path ();
| ^~~~~~~~~~~~~~~~~~~~~~~
'test_2': event 1
- |
- | NN | i = SETJMP(env);
- | | ^~~~~~
- | | |
- | | (1) 'setjmp' called here
- |
+ NN | i = SETJMP(env);
+ | ^~~~~~
+ | |
+ | (1) 'setjmp' called here
'test_2': events 2-4
- |
- | NN | if (i != 0)
- | | ^
- | | |
- | | (2) following 'false' branch (when 'i == 0')...
- |......
- | NN | longjmp (env, 1);
- | | ~~~~~~~~~~~~~~~~
- | | |
- | | (3) ...to here
- | | (4) rewinding within 'test_2' from 'longjmp'...
- |
+ NN | if (i != 0)
+ | ^
+ | |
+ | (2) following 'false' branch (when 'i == 0')...
+......
+ NN | longjmp (env, 1);
+ | ~~~~~~~~~~~~~~~~
+ | |
+ | (3) ...to here
+ | (4) rewinding within 'test_2' from 'longjmp'...
'test_2': event 5
- |
- | NN | i = SETJMP(env);
- | | ^~~~~~
- | | |
- | | (5) ...to 'setjmp' (saved at (1))
- |
+ NN | i = SETJMP(env);
+ | ^~~~~~
+ | |
+ | (5) ...to 'setjmp' (saved at (1))
'test_2': events 6-8
- |
- | NN | if (i != 0)
- | | ^
- | | |
- | | (6) following 'true' branch (when 'i != 0')...
- | NN | {
- | NN | foo (2);
- | | ~~~~~~~
- | | |
- | | (7) ...to here
- | NN | __analyzer_dump_path ();
- | | ~~~~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (8) here
- |
+ NN | if (i != 0)
+ | ^
+ | |
+ | (6) following 'true' branch (when 'i != 0')...
+ NN | {
+ NN | foo (2);
+ | ~~~~~~~
+ | |
+ | (7) ...to here
+ NN | __analyzer_dump_path ();
+ | ~~~~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (8) here
{ dg-end-multiline-output "" { target c } } */
/* { dg-begin-multiline-output "" }
NN | __analyzer_dump_path ();
| ~~~~~~~~~~~~~~~~~~~~~^~
'void test_2()': event 1
- |
- | NN | i = SETJMP(env);
- | | ^~~~~~
- | | |
- | | (1) 'setjmp' called here
- |
+ NN | i = SETJMP(env);
+ | ^~~~~~
+ | |
+ | (1) 'setjmp' called here
'void test_2()': events 2-4
- |
- | NN | if (i != 0)
- | | ^~
- | | |
- | | (2) following 'false' branch (when 'i == 0')...
- |......
- | NN | longjmp (env, 1);
- | | ~~~~~~~~~~~~~~~~
- | | |
- | | (3) ...to here
- | | (4) rewinding within 'test_2' from 'longjmp'...
- |
+ NN | if (i != 0)
+ | ^~
+ | |
+ | (2) following 'false' branch (when 'i == 0')...
+......
+ NN | longjmp (env, 1);
+ | ~~~~~~~~~~~~~~~~
+ | |
+ | (3) ...to here
+ | (4) rewinding within 'test_2' from 'longjmp'...
'void test_2()': event 5
- |
- | NN | i = SETJMP(env);
- | | ^~~~~~
- | | |
- | | (5) ...to 'setjmp' (saved at (1))
- |
+ NN | i = SETJMP(env);
+ | ^~~~~~
+ | |
+ | (5) ...to 'setjmp' (saved at (1))
'void test_2()': events 6-8
- |
- | NN | if (i != 0)
- | | ^~
- | | |
- | | (6) following 'true' branch (when 'i != 0')...
- | NN | {
- | NN | foo (2);
- | | ~~~~~~~
- | | |
- | | (7) ...to here
- | NN | __analyzer_dump_path ();
- | | ~~~~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (8) here
- |
+ NN | if (i != 0)
+ | ^~
+ | |
+ | (6) following 'true' branch (when 'i != 0')...
+ NN | {
+ NN | foo (2);
+ | ~~~~~~~
+ | |
+ | (7) ...to here
+ NN | __analyzer_dump_path ();
+ | ~~~~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (8) here
{ dg-end-multiline-output "" { target c++ } } */
void test_3 (void)
NN | free (ptr);
| ^~~~~~~~~~
'test_1': events 1-3
- |
- | NN | void *ptr = malloc (1024);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (2) first 'free' here
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (3) second 'free' here; first 'free' was at (2)
- |
+ NN | void *ptr = malloc (1024);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (2) first 'free' here
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (3) second 'free' here; first 'free' was at (2)
{ dg-end-multiline-output "" } */
void test_2 (int x, int y)
NN | free (ptr);
| ^~~~~~~~~~
'test_2': events 1-7
- |
- | NN | void *ptr = malloc (1024);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | if (x)
- | | ~
- | | |
- | | (2) following 'true' branch (when 'x != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (3) ...to here
- | | (4) first 'free' here
- | NN | if (y)
- | | ~
- | | |
- | | (5) following 'true' branch (when 'y != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (6) ...to here
- | | (7) second 'free' here; first 'free' was at (4)
- |
+ NN | void *ptr = malloc (1024);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | if (x)
+ | ~
+ | |
+ | (2) following 'true' branch (when 'x != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (3) ...to here
+ | (4) first 'free' here
+ NN | if (y)
+ | ~
+ | |
+ | (5) following 'true' branch (when 'y != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (6) ...to here
+ | (7) second 'free' here; first 'free' was at (4)
{ dg-end-multiline-output "" } */
/* "leak of 'ptr'. */
NN | }
| ^
'test_2': events 1-6
- |
- | NN | void *ptr = malloc (1024);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | if (x)
- | | ~
- | | |
- | | (2) following 'false' branch (when 'x == 0')...
- | NN | free (ptr);
- | NN | if (y)
- | | ~
- | | |
- | | (3) ...to here
- | | (4) following 'false' branch (when 'y == 0')...
- | NN | free (ptr);
- | NN | }
- | | ~
- | | |
- | | (5) ...to here
- | | (6) 'ptr' leaks here; was allocated at (1)
- |
+ NN | void *ptr = malloc (1024);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | if (x)
+ | ~
+ | |
+ | (2) following 'false' branch (when 'x == 0')...
+ NN | free (ptr);
+ NN | if (y)
+ | ~
+ | |
+ | (3) ...to here
+ | (4) following 'false' branch (when 'y == 0')...
+ NN | free (ptr);
+ NN | }
+ | ~
+ | |
+ | (5) ...to here
+ | (6) 'ptr' leaks here; was allocated at (1)
{ dg-end-multiline-output "" } */
int test_3 (int x, int y)
NN | *ptr = 42;
| ~~~~~^~~~
'test_3': events 1-2
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ^~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (1) this call could return NULL
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) 'ptr' could be NULL: unchecked value from (1)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ^~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (1) this call could return NULL
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) 'ptr' could be NULL: unchecked value from (1)
{ dg-end-multiline-output "" } */
/* "use after 'free' of 'ptr'". */
NN | *ptr = 19;
| ~~~~~^~~~
'test_3': events 1-6
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ^~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~
- | | |
- | | (3) following 'true' branch (when 'x != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (4) ...to here
- | | (5) freed here
- | NN |
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (6) use after 'free' of 'ptr'; freed at (5)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ^~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~
+ | |
+ | (3) following 'true' branch (when 'x != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (4) ...to here
+ | (5) freed here
+ NN |
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (6) use after 'free' of 'ptr'; freed at (5)
{ dg-end-multiline-output "" } */
/* "use after 'free' of 'ptr'". */
NN | return *ptr;
| ^~~~
'test_3': events 1-8
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ^~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~
- | | |
- | | (3) following 'false' branch (when 'x == 0')...
- |......
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (4) ...to here
- |......
- | NN | if (y)
- | | ~
- | | |
- | | (5) following 'true' branch (when 'y != 0')...
- | NN | free (ptr);
- | | ~~~~~~~~~~
- | | |
- | | (6) ...to here
- | | (7) freed here
- | NN |
- | NN | return *ptr;
- | | ~~~~
- | | |
- | | (8) use after 'free' of 'ptr'; freed at (7)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ^~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~
+ | |
+ | (3) following 'false' branch (when 'x == 0')...
+......
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (4) ...to here
+......
+ NN | if (y)
+ | ~
+ | |
+ | (5) following 'true' branch (when 'y != 0')...
+ NN | free (ptr);
+ | ~~~~~~~~~~
+ | |
+ | (6) ...to here
+ | (7) freed here
+ NN |
+ NN | return *ptr;
+ | ~~~~
+ | |
+ | (8) use after 'free' of 'ptr'; freed at (7)
{ dg-end-multiline-output "" } */
/* "leak of 'ptr'". */
NN | return *ptr;
| ^~~~
'test_3': events 1-7
- |
- | NN | int *ptr = (int *)malloc (sizeof (int));
- | | ^~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (1) allocated here
- | NN | *ptr = 42;
- | | ~~~~~~~~~
- | | |
- | | (2) assuming 'ptr' is non-NULL
- | NN | if (x)
- | | ~
- | | |
- | | (3) following 'false' branch (when 'x == 0')...
- |......
- | NN | *ptr = 19;
- | | ~~~~~~~~~
- | | |
- | | (4) ...to here
- |......
- | NN | if (y)
- | | ~
- | | |
- | | (5) following 'false' branch (when 'y == 0')...
- |......
- | NN | return *ptr;
- | | ~~~~
- | | |
- | | (6) ...to here
- | | (7) 'ptr' leaks here; was allocated at (1)
- |
+ NN | int *ptr = (int *)malloc (sizeof (int));
+ | ^~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (1) allocated here
+ NN | *ptr = 42;
+ | ~~~~~~~~~
+ | |
+ | (2) assuming 'ptr' is non-NULL
+ NN | if (x)
+ | ~
+ | |
+ | (3) following 'false' branch (when 'x == 0')...
+......
+ NN | *ptr = 19;
+ | ~~~~~~~~~
+ | |
+ | (4) ...to here
+......
+ NN | if (y)
+ | ~
+ | |
+ | (5) following 'false' branch (when 'y == 0')...
+......
+ NN | return *ptr;
+ | ~~~~
+ | |
+ | (6) ...to here
+ | (7) 'ptr' leaks here; was allocated at (1)
{ dg-end-multiline-output "" } */
arr[n] = x;
~~~~~~~^~~
'int_vla_write_element_after_end_off_by_one': events 1-2 (depth 1)
- |
- | int32_t arr[n];
- | ^~~
- | |
- | (1) capacity: 'n * 4' bytes
- |
- | arr[n] = x;
- | ~~~~~~~~~~
- | |
- | (2) write of 4 bytes at offset 'n * 4' exceeds the buffer
- |
+ int32_t arr[n];
+ ^~~
+ |
+ (1) capacity: 'n * 4' bytes
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ arr[n] = x;
+ ~~~~~~~~~~
+ |
+ (2) write of 4 bytes at offset 'n * 4' exceeds the buffer
{ dg-end-multiline-output "" } */
29 | PyList_Append(list, item);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
'make_a_list_of_random_ints_badly': events 1-3
- |
- | 25 | list = PyList_New(0);
- | | ^~~~~~~~~~~~~
- | | |
- | | (1) when 'PyList_New' fails, returning NULL
- | 26 |
- | 27 | for (i = 0; i < count; i++) {
- | | ~~~~~~~~~
- | | |
- | | (2) when 'i < count'
- | 28 | item = PyLong_FromLong(random());
- | 29 | PyList_Append(list, item);
- | | ~~~~~~~~~~~~~~~~~~~~~~~~~
- | | |
- | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
- |
+ 25 | list = PyList_New(0);
+ | ^~~~~~~~~~~~~
+ | |
+ | (1) when 'PyList_New' fails, returning NULL
+ 26 |
+ 27 | for (i = 0; i < count; i++) {
+ | ~~~~~~~~~
+ | |
+ | (2) when 'i < count'
+ 28 | item = PyLong_FromLong(random());
+ 29 | PyList_Append(list, item);
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | |
+ | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
{ dg-end-multiline-output "" } */
}
const char *get_name () const { return m_name.get (); }
unsigned get_swimlane_index () const { return m_swimlane_idx; }
+ bool interprocedural_p () const;
+
private:
friend struct path_summary;
friend class thread_event_printer;
}
};
+/* Return true iff there is more than one stack frame used by the events
+ of this thread. */
+
+bool
+per_thread_summary::interprocedural_p () const
+{
+ if (m_event_ranges.is_empty ())
+ return false;
+ tree first_fndecl = m_event_ranges[0]->m_fndecl;
+ int first_stack_depth = m_event_ranges[0]->m_stack_depth;
+ for (auto range : m_event_ranges)
+ {
+ if (range->m_fndecl != first_fndecl)
+ return true;
+ if (range->m_stack_depth != first_stack_depth)
+ return true;
+ }
+ return false;
+}
+
/* path_summary's ctor. */
path_summary::path_summary (const diagnostic_path &path,
= colorize_start (pp_show_color (pp), line_color);
const char *end_line_color = colorize_stop (pp_show_color (pp));
+ const bool interprocedural_p = m_per_thread_summary.interprocedural_p ();
+
write_indent (pp, m_cur_indent);
if (const event_range *prev_range = get_any_prev_range ())
{
if (range->m_stack_depth > prev_range->m_stack_depth)
{
+ gcc_assert (interprocedural_p);
/* Show pushed stack frame(s). */
const char *push_prefix = "+--> ";
pp_string (pp, start_line_color);
pp_newline (pp);
/* Print a run of events. */
- {
- write_indent (pp, m_cur_indent + per_frame_indent);
- pp_string (pp, start_line_color);
- pp_string (pp, "|");
- pp_string (pp, end_line_color);
- pp_newline (pp);
-
- char *saved_prefix = pp_take_prefix (pp);
- char *prefix;
+ if (interprocedural_p)
{
- pretty_printer tmp_pp;
- write_indent (&tmp_pp, m_cur_indent + per_frame_indent);
- pp_string (&tmp_pp, start_line_color);
- pp_string (&tmp_pp, "|");
- pp_string (&tmp_pp, end_line_color);
- prefix = xstrdup (pp_formatted_text (&tmp_pp));
+ write_indent (pp, m_cur_indent + per_frame_indent);
+ pp_string (pp, start_line_color);
+ pp_string (pp, "|");
+ pp_string (pp, end_line_color);
+ pp_newline (pp);
+
+ char *saved_prefix = pp_take_prefix (pp);
+ char *prefix;
+ {
+ pretty_printer tmp_pp;
+ write_indent (&tmp_pp, m_cur_indent + per_frame_indent);
+ pp_string (&tmp_pp, start_line_color);
+ pp_string (&tmp_pp, "|");
+ pp_string (&tmp_pp, end_line_color);
+ prefix = xstrdup (pp_formatted_text (&tmp_pp));
+ }
+ pp_set_prefix (pp, prefix);
+ pp_prefixing_rule (pp) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
+ range->print (dc, pp);
+ pp_set_prefix (pp, saved_prefix);
+
+ write_indent (pp, m_cur_indent + per_frame_indent);
+ pp_string (pp, start_line_color);
+ pp_string (pp, "|");
+ pp_string (pp, end_line_color);
+ pp_newline (pp);
}
- pp_set_prefix (pp, prefix);
- pp_prefixing_rule (pp) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
+ else
range->print (dc, pp);
- pp_set_prefix (pp, saved_prefix);
-
- write_indent (pp, m_cur_indent + per_frame_indent);
- pp_string (pp, start_line_color);
- pp_string (pp, "|");
- pp_string (pp, end_line_color);
- pp_newline (pp);
- }
if (const event_range *next_range = get_any_next_range ())
{
" |\n"
" <------------ +\n"
" |\n". */
+ gcc_assert (interprocedural_p);
int vbar_for_next_frame
= *m_vbar_column_for_depth.get (next_range->m_stack_depth);
else if (range->m_stack_depth < next_range->m_stack_depth)
{
/* Prepare to show pushed stack frame. */
+ gcc_assert (interprocedural_p);
gcc_assert (range->m_stack_depth != EMPTY);
gcc_assert (range->m_stack_depth != DELETED);
m_vbar_column_for_depth.put (range->m_stack_depth,
test_diagnostic_context dc;
print_path_summary_as_text (&summary, &dc, true);
ASSERT_STREQ (" `foo': events 1-2 (depth 0)\n"
- " |\n"
- " | (1): first `free'\n"
- " | (2): double `free'\n"
- " |\n",
+ " (1): first `free'\n"
+ " (2): double `free'\n",
pp_formatted_text (dc.printer));
}