analyzer: fix signal-handler registration location [PR95188]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 29 Sep 2020 19:55:33 +0000 (15:55 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 29 Sep 2020 22:31:48 +0000 (18:31 -0400)
commitd60d63a00bb50ba6896939705c589578177b404d
tree2390b33d72cd9991a58cf27f41884a809a2a3141
parent6649df18f98d5baf89b56a09b816b5eeb5f67bcb
analyzer: fix signal-handler registration location [PR95188]

PR analyzer/95188 reports that diagnostics from
-Wanalyzer-unsafe-call-within-signal-handler use the wrong
source location when reporting the signal-handler registration
event in the diagnostic_path.  The diagnostics erroneously use the
location of the first stmt in the basic block containing the call
to "signal", rather than that of the call itself.

Fixed thusly.

gcc/analyzer/ChangeLog:
PR analyzer/95188
* engine.cc (stmt_requires_new_enode_p): Split enodes before
"signal" calls.

gcc/testsuite/ChangeLog:
PR analyzer/95188
* gcc.dg/analyzer/signal-registration-loc.c: New test.
gcc/analyzer/engine.cc
gcc/testsuite/gcc.dg/analyzer/signal-registration-loc.c [new file with mode: 0644]