diff options
author | David Malcolm <dmalcolm@redhat.com> | 2019-12-21 08:49:03 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-01-14 20:55:47 -0500 |
commit | 7fb3669edb4aa3c8313ddf8b914b86a1623e0954 (patch) | |
tree | b578fa335525be8fd6e7dc142d11be4e091dc15b /gcc/alias.c | |
parent | e2a538b1c31a13fc3d2f6d8ac3f341437775e984 (diff) | |
download | gcc-7fb3669edb4aa3c8313ddf8b914b86a1623e0954.zip gcc-7fb3669edb4aa3c8313ddf8b914b86a1623e0954.tar.gz gcc-7fb3669edb4aa3c8313ddf8b914b86a1623e0954.tar.bz2 |
analyzer: fix global-sm-state issue affecting sm-signal
sm-signal.cc was failing to warn about the use of an fprintf call in a
signal handler when the signal handler function was non-static.
The root cause was a failure to copy global sm-state within
sm_state_map::clone_with_remapping as called by
program_state::can_merge_with_p, which led to the exploded node for
the entrypoint to the handler in the "normal" state being erroneously
reused for the "in_signal_handler" state, thus losing the global state,
and thus failing to warn.
This patch fixes the above, so that non-equal global sm-state values
prevent merger of program_state, thus requiring separate exploded nodes
for the "normal" and "in signal handler" states, and thus triggering
the warning for the reproducer.
gcc/analyzer/ChangeLog:
* program-state.cc (sm_state_map::clone_with_remapping): Copy
m_global_state.
(selftest::test_program_state_merging_2): New selftest.
(selftest::analyzer_program_state_cc_tests): Call it.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/signal-6.c: New test.
Diffstat (limited to 'gcc/alias.c')
0 files changed, 0 insertions, 0 deletions