analyzer: fixes to file-descriptor handling
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 26 Oct 2022 20:45:17 +0000 (16:45 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 26 Oct 2022 20:45:17 +0000 (16:45 -0400)
commit57bbf3a403bb1e77c5081dc25d2d54e5c3d5aae4
tree47b211413c221db4ed8e57b11323980f98de9165
parent593254ae03a6c0db5946e44b2cfd90dbfc707a17
analyzer: fixes to file-descriptor handling

gcc/analyzer/ChangeLog:
* sm-fd.cc (fd_state_machine::on_open): Transition to "unchecked"
when the mode is symbolic, rather than just on integer constants.
(fd_state_machine::check_for_open_fd): Don't complain about
unchecked values in the start state.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/fd-3.c (test_5): Expect "opened here" message
even when flags are symbolic.
(test_read_from_symbolic_fd): New.
(test_write_to_symbolic_fd): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/sm-fd.cc
gcc/testsuite/gcc.dg/analyzer/fd-3.c