public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/99738] New: RFE: analyzer should complain about unchecked FILE *
@ 2021-03-23 20:37 dmalcolm at gcc dot gnu.org
0 siblings, 0 replies; only message in thread
From: dmalcolm at gcc dot gnu.org @ 2021-03-23 20:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99738
Bug ID: 99738
Summary: RFE: analyzer should complain about unchecked FILE *
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Target Milestone: ---
In PR 99716 I noted we don't complain about the fprintf in:
FILE *fp = fopen ("/tmp/test", "w");
fprintf (fp, "hello");
fclose (fp);
This becomes the following at the gimple ssa level:
fp_7 = fopen ("/tmp/test", "w");
__builtin_fwrite ("hello", 1, 5, fp_7);
fclose (fp_7);
and we have:
DEF_LIB_BUILTIN (BUILT_IN_FWRITE, "fwrite",
BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR, ATTR_NONNULL_LIST)
so we should have complained due to the ATTR_NONNULL_LIST due to fp_7 being in
the "unchecked" state in the "file" state machine.
Turns out that sm-file.cc doesn't yet implement checks for the "unchecked"
state, and probably should (or somehow be merged with sm-malloc.cc).
Filing this here as it's probably a bit late to be adding this for GCC 11.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-23 20:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 20:37 [Bug analyzer/99738] New: RFE: analyzer should complain about unchecked FILE * dmalcolm at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).