Bug path

main
‘main’: events 1-2
24int main(int argc, const char *argv)
^~~~
|
(1) entry to ‘main’
25{
26 custom_logger("started");
~~~~~~~~~~~~~~~~~~~~~~~~
|
(2) calling ‘custom_logger’ from ‘main’
custom_logger
‘custom_logger’: events 3-5
13void custom_logger(const char *msg)
^~~~~~~~~~~~~
|
(3) entry to ‘custom_logger’
14{
15 if (logging)
~
|
(4) following ‘true’ branch...
16 fprintf(stderr, "LOG: %s", msg); /* { dg-warning "call to 'fprintf' from within signal handler" } */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(5) ...to here
‘main’: events 6-7
26 custom_logger("started");
^~~~~~~~~~~~~~~~~~~~~~~~
|
(6) returning to ‘main’ from ‘custom_logger’
27
28 signal(SIGINT, handler); /* { dg-message "registering 'handler' as signal handler" } */
~~~~~~~~~~~~~~~~~~~~~~~
|
(7) registering ‘handler’ as signal handler
event 8
(8): later on, when the signal is delivered to the process
handler
‘handler’: events 9-10
19static void handler(int signum)
^~~~~~~
|
(9) entry to ‘handler’
20{
21 custom_logger("got signal");
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(10) calling ‘custom_logger’ from ‘handler’
custom_logger
‘custom_logger’: events 11-14
13void custom_logger(const char *msg)
^~~~~~~~~~~~~
|
(11) entry to ‘custom_logger’
14{
15 if (logging)
~
|
(12) following ‘true’ branch...
16 fprintf(stderr, "LOG: %s", msg); /* { dg-warning "call to 'fprintf' from within signal handler" } */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(13) ...to here
(14) call to ‘fprintf’ from within signal handler