public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/106388] New: Support for use-after-move in -fanalyzer
@ 2022-07-21 17:06 redi at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: redi at gcc dot gnu.org @ 2022-07-21 17:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106388

            Bug ID: 106388
           Summary: Support for use-after-move in -fanalyzer
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 97110
  Target Milestone: ---

Flag use-after-move, for some types at least.

For most std::lib types, they are in a "valid, but unspecified" state after
being moved. That means they maintain their invariants, but beyond that you
don't know if they are empty, unaltered, or full of arbitrary values.

Allow functions that have no preconditions, as those are always allowed on a
moved-from object. e.g.
- vector::empty() or vector::size() is safe on a moved-from vector, but
vector::front() isn't safe until you've checked whether or not it's empty.
- vector::clear() is safe on any vector, and restores it to a known state (i.e
empty).

Knowing which functions have preconditions or not requires knowledge of the
type, which PR 106386 would help with.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97110
[Bug 97110] [meta-bug] tracker bug for supporting C++ in -fanalyzer

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-21 17:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21 17:06 [Bug analyzer/106388] New: Support for use-after-move in -fanalyzer redi 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).