/* SARIF's endColumn is 1 beyond the final column in the region,
whereas GCC's end columns are inclusive. */
end = m_output_mgr.new_location_from_file_line_column
- (file, end_line, end_column_jnum->get ());
+ (file, end_line, end_column_jnum->get () - 1);
}
else
{
/* { dg-begin-multiline-output "" }
/this/does/not/exist/test.bas:2:8: error: 'GOTO' is considered harmful
2 | GOTO label
- | ^~~~~~~~~~
+ | ^~~~~~~~~~
{ dg-end-multiline-output "" } */
/* { dg-begin-multiline-output "" }
/this/does/not/exist/test.bas:1:1: note: this is the target of the 'GOTO'
1 | label: PRINT "hello world!"
- | ^~~~~~
+ | ^~~~~
{ dg-end-multiline-output "" } */
// TODO: trailing [error]
In function 'callee_1':
/not/a/real/path/malloc-vs-local-4.c:5:3: warning: dereference of possibly-NULL ‘ptr’ [-Wanalyzer-possible-null-dereference]
5 | *ptr = 42;
- | ^~~~~~~~~~
+ | ^~~~~~~~~
'test_1': events 1-5
|
| 8 | int test_1 (int i, int flag)
- | | ^~~~~~~
+ | | ^~~~~~
| | |
| | (1) entry to ‘test_1’
|......
| 12 | if (flag)
- | | ~~
+ | | ~
| | |
| | (2) following ‘true’ branch (when ‘flag != 0’)...
| 13 | ptr = (int *)malloc (sizeof (int));
- | | ~~~~~~~~~~~~~~~~~~~~~~
+ | | ~~~~~~~~~~~~~~~~~~~~~
| | |
| | (3) ...to here
| | (4) this call could return NULL
| 14 | callee_1 (ptr);
- | | ~~~~~~~~~~~~~~~
+ | | ~~~~~~~~~~~~~~
| | |
| | (5) calling ‘callee_1’ from ‘test_1’
|
+--> 'callee_1': events 6-7
|
| 3 | void __attribute__((noinline)) callee_1 (int *ptr)
- | | ^~~~~~~~~
+ | | ^~~~~~~~
| | |
| | (6) entry to ‘callee_1’
| 4 | {
| 5 | *ptr = 42;
- | | ~~~~~~~~~~
+ | | ~~~~~~~~~
| | |
| | (7) ‘ptr’ could be NULL: unchecked value from (4)
|
In function 'test_2':
/not/a/real/path/malloc-vs-local-4.c:38:7: warning: double-‘free’ of ‘ptr’ [-Wanalyzer-double-free]
38 | free (ptr);
- | ^~~~~~~~~~~
+ | ^~~~~~~~~~
'test_2': events 1-5
34 | if (!flag)
- | ^~
+ | ^
| |
| (1) following ‘true’ branch (when ‘flag == 0’)...
35 | {
36 | void *ptr = malloc (16);
- | ~~~~~~~~~~~~
+ | ~~~~~~~~~~~
| |
| (2) ...to here
| (3) allocated here
37 | free (ptr);
- | ~~~~~~~~~~~
+ | ~~~~~~~~~~
| |
| (4) first ‘free’ here
38 | free (ptr);
- | ~~~~~~~~~~~
+ | ~~~~~~~~~~
| |
| (5) second ‘free’ here; first ‘free’ was at (4)
{ dg-end-multiline-output "" } */
In function 'custom_logger':
signal-1.c:13:3: warning: call to ‘fprintf’ from within signal handler [-Wanalyzer-unsafe-call-within-signal-handler]
13 | fprintf(stderr, "LOG: %s", msg);
- | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'main': events 1-2
|
| 21 | int main(int argc, const char *argv)
- | | ^~~~~
+ | | ^~~~
| | |
| | (1) entry to ‘main’
|......
| 25 | signal(SIGINT, handler);
- | | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | | ~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (2) registering ‘handler’ as signal handler
|
+--> 'handler': events 4-5
|
| 16 | static void handler(int signum)
- | | ^~~~~~~~
+ | | ^~~~~~~
| | |
| | (4) entry to ‘handler’
| 17 | {
| 18 | custom_logger("got signal");
- | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (5) calling ‘custom_logger’ from ‘handler’
|
+--> 'custom_logger': events 6-7
|
| 11 | void custom_logger(const char *msg)
- | | ^~~~~~~~~~~~~~
+ | | ^~~~~~~~~~~~~
| | |
| | (6) entry to ‘custom_logger’
| 12 | {
| 13 | fprintf(stderr, "LOG: %s", msg);
- | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (7) call to ‘fprintf’ from within signal handler
|
In function 'custom_logger':
../../src/gcc/testsuite/gcc.dg/analyzer/signal-1.c:13:3: warning: call to ‘fprintf’ from within signal handler [-Wanalyzer-unsafe-call-within-signal-handler]
13 | fprintf(stderr, "LOG: %s", msg);
- | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'main': events 1-2
|
| 21 | int main(int argc, const char *argv)
- | | ^~~~~
+ | | ^~~~
| | |
| | (1) entry to ‘main’
|......
| 25 | signal(SIGINT, handler);
- | | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | | ~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (2) registering ‘handler’ as signal handler
|
+--> 'handler': events 4-5
|
| 16 | static void handler(int signum)
- | | ^~~~~~~~
+ | | ^~~~~~~
| | |
| | (4) entry to ‘handler’
| 17 | {
| 18 | custom_logger("got signal");
- | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (5) calling ‘custom_logger’ from ‘handler’
|
+--> 'custom_logger': events 6-7
|
| 11 | void custom_logger(const char *msg)
- | | ^~~~~~~~~~~~~~
+ | | ^~~~~~~~~~~~~
| | |
| | (6) entry to ‘custom_logger’
| 12 | {
| 13 | fprintf(stderr, "LOG: %s", msg);
- | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (7) call to ‘fprintf’ from within signal handler
|