This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/59856] Support sparse-style context checking, used to validate locking correctness


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

--- Comment #16 from Josh Triplett <josh at joshtriplett dot org> ---
(In reply to PaX Team from comment #14)
> (In reply to Josh Triplett from comment #13)
> > This approach won't necessarily provide the "different contexts for basic
> > block" warning that Sparse has, but I don't necessarily think we need that;
> 
> can you give me an example of this?

Sparse warns if you can reach the same basic block with different context
values (for instance, with or without a lock held).  That warning *may*
indicate a problem, but it can also just indicate code too intricate for Sparse
to understand.

> the thing is, my approach tracks the
> context with statement granularity so if you can tell the compiler where you
> expect specific states (such as the context attr on callees) checks can be
> inserted there easily, down to individual statements (say, the structure
> field accesses you mentioned).

Sounds good to me.

(In reply to Tom Tromey from comment #15)
> Anyway given that this is happening, I suggest closing this gcc bug.

Have we completely ruled out the possibility of a native GCC implementation? 
This really doesn't seem specific to the Linux kernel in any way; it'd be nice
if this could work in most programs.  We could add annotations to pthread
locking functions, and any program using locking would benefit.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]