This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/84732] false-positive -Wstringop-truncation warning with -fsanitize-coverage=trace-pc
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Mar 2018 16:57:01 +0000
- Subject: [Bug sanitizer/84732] false-positive -Wstringop-truncation warning with -fsanitize-coverage=trace-pc
- Auto-submitted: auto-generated
- References: <bug-84732-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84732
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #2)
> I guess it somehow confuses VRP, Martin can you please take a look? Note
> that __builtin___sanitizer_cov_trace_pc is pure function, can't modify
> memory in original program.
No, __builtin___sanitizer_cov_trace_pc is certainly not pure and can't really
be, otherwise would optimize them all away (nothing uses their void return
value),
so the problem is that it invalidates all recorded string lengths, at least
those that escape (but in this testcase it is a global variable).
As __sanitizer_cov_trace_pc is a user-supplied function, I don't really think
we can assume anything on it (e.g. that it will not change any global or
escaped local variables, it can change them and most likely will do at least
some of them, otherwise it would be useless).