if (lhs)
{
tree arg = gimple_call_arg (call, 1);
+ enum access_mode mode = READ_WRITE;
if (TREE_CODE (arg) == INTEGER_CST)
{
int flag = TREE_INT_CST_LOW (arg);
- enum access_mode mode = get_access_mode_from_flag (flag);
-
- switch (mode)
- {
- case READ_ONLY:
- sm_ctxt->on_transition (node, stmt, lhs, m_start,
- m_unchecked_read_only);
- break;
- case WRITE_ONLY:
- sm_ctxt->on_transition (node, stmt, lhs, m_start,
- m_unchecked_write_only);
- break;
- default:
- sm_ctxt->on_transition (node, stmt, lhs, m_start,
- m_unchecked_read_write);
- }
+ mode = get_access_mode_from_flag (flag);
+ }
+ switch (mode)
+ {
+ case READ_ONLY:
+ sm_ctxt->on_transition (node, stmt, lhs, m_start,
+ m_unchecked_read_only);
+ break;
+ case WRITE_ONLY:
+ sm_ctxt->on_transition (node, stmt, lhs, m_start,
+ m_unchecked_write_only);
+ break;
+ default:
+ sm_ctxt->on_transition (node, stmt, lhs, m_start,
+ m_unchecked_read_write);
}
}
else
else
{
- if (!(is_valid_fd_p (state) || (state == m_stop)))
+ if (!(is_valid_fd_p (state) || state == m_start || state == m_stop))
{
if (!is_constant_fd_p (state))
sm_ctxt->warn (
int flags = O_RDONLY;
if (some_condition())
flags |= O_NOATIME;
- int fd = open (path, flags);
+ int fd = open (path, flags); /* { dg-message "\\(1\\) opened here" } */
read (fd, buf, 1); /* { dg-warning "'read' on possibly invalid file descriptor 'fd'" } */
- /* { dg-message "\\(1\\) 'fd' could be invalid" "" { target *-*-* } .-1 } */
+ /* { dg-message "\\(2\\) 'fd' could be invalid" "" { target *-*-* } .-1 } */
close (fd);
}
}
close(fd);
-}
\ No newline at end of file
+}
+
+void
+test_read_from_symbolic_fd (int fd, void *buf)
+{
+ read (fd, buf, 1);
+}
+
+void
+test_write_to_symbolic_fd (int fd, void *buf)
+{
+ write (fd, buf, 1);
+}