public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/105888] New: RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function
@ 2022-06-08 14:30 dmalcolm at gcc dot gnu.org
2022-06-16 14:17 ` [Bug analyzer/105888] " dmalcolm at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-06-08 14:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105888
Bug ID: 105888
Summary: RFE: -fanalyzer should complain when an on-stack
address escapes/outlives the function
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Blocks: 105887
Target Milestone: ---
Implemented by Clang here:
https://clang.llvm.org/docs/analyzer/checkers.html#core-stackaddressescape-c
Seems useful and fairly easy to implement. The analyzer already has
-Wanalyzer-use-of-pointer-in-stale-stack-frame
but we might as well detect stack addresses escaping. Currently
region_model::pop_frame has:
unbind_region_and_descendents (frame_reg,POISON_KIND_POPPED_STACK);
which updates anything pointing to frame_reg or within, so that could
be adapted to make a new warning.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105887
[Bug 105887] RFE: clang analyzer warnings that GCC's -fanalyzer could implement
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug analyzer/105888] RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function
2022-06-08 14:30 [Bug analyzer/105888] New: RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function dmalcolm at gcc dot gnu.org
@ 2022-06-16 14:17 ` dmalcolm at gcc dot gnu.org
2022-07-05 18:19 ` tlange at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-06-16 14:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105888
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
See also CWE-562: Return of Stack Variable Address
https://cwe.mitre.org/data/definitions/562.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug analyzer/105888] RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function
2022-06-08 14:30 [Bug analyzer/105888] New: RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function dmalcolm at gcc dot gnu.org
2022-06-16 14:17 ` [Bug analyzer/105888] " dmalcolm at gcc dot gnu.org
@ 2022-07-05 18:19 ` tlange at gcc dot gnu.org
2022-07-05 18:20 ` tlange at gcc dot gnu.org
2024-06-01 18:31 ` dmalcolm at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: tlange at gcc dot gnu.org @ 2022-07-05 18:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105888
Tim Lange <tlange at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tlange at gcc dot gnu.org
--- Comment #2 from Tim Lange <tlange at gcc dot gnu.org> ---
I do have a fast prototype of this feature, but polishing that would require
PR105888 first. I plan to work on other checkers and get more familiar with the
code first, and then tackling PR105888 and hence this PR.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug analyzer/105888] RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function
2022-06-08 14:30 [Bug analyzer/105888] New: RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function dmalcolm at gcc dot gnu.org
2022-06-16 14:17 ` [Bug analyzer/105888] " dmalcolm at gcc dot gnu.org
2022-07-05 18:19 ` tlange at gcc dot gnu.org
@ 2022-07-05 18:20 ` tlange at gcc dot gnu.org
2024-06-01 18:31 ` dmalcolm at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: tlange at gcc dot gnu.org @ 2022-07-05 18:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105888
--- Comment #3 from Tim Lange <tlange at gcc dot gnu.org> ---
(In reply to Tim Lange from comment #2)
> I do have a fast prototype of this feature, but polishing that would require
> PR105888 first. I plan to work on other checkers and get more familiar with
> the code first, and then tackling PR105888 and hence this PR.
I obviously meant PR106203 :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug analyzer/105888] RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function
2022-06-08 14:30 [Bug analyzer/105888] New: RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function dmalcolm at gcc dot gnu.org
` (2 preceding siblings ...)
2022-07-05 18:20 ` tlange at gcc dot gnu.org
@ 2024-06-01 18:31 ` dmalcolm at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-06-01 18:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105888
Bug 105888 depends on bug 106203, which changed state.
Bug 106203 Summary: Allow to emit diagnostics at return edges for the exit point as well as the call site
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106203
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-01 18:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 14:30 [Bug analyzer/105888] New: RFE: -fanalyzer should complain when an on-stack address escapes/outlives the function dmalcolm at gcc dot gnu.org
2022-06-16 14:17 ` [Bug analyzer/105888] " dmalcolm at gcc dot gnu.org
2022-07-05 18:19 ` tlange at gcc dot gnu.org
2022-07-05 18:20 ` tlange at gcc dot gnu.org
2024-06-01 18:31 ` 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).