public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/106218] New: Analyzer false positives with Linux kernel's err.h
@ 2022-07-06 18:27 dmalcolm at gcc dot gnu.org
0 siblings, 0 replies; only message in thread
From: dmalcolm at gcc dot gnu.org @ 2022-07-06 18:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106218
Bug ID: 106218
Summary: Analyzer false positives with Linux kernel's err.h
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
Target Milestone: ---
The Linux kernel has a header include/linux/err.h which stuffs small negative
values into pointers.
The analyzer's constraint handling doesn't handle this very well at the moment.
For example:
extern void __analyzer_dump_path (void);
long __attribute__((noinline))
PTR_ERR(const void *ptr) {
return (long)ptr;
}
_Bool __attribute__((noinline))
IS_ERR(const void *ptr) {
return (unsigned long)(void *)((unsigned long)ptr) >= (unsigned long)-4095;
}
long __attribute__((noinline))
test(void *ptr)
{
if (IS_ERR(ptr)) {
int err = PTR_ERR(ptr);
if (!err)
__analyzer_dump_path (); // BUG: shouldn't get here
}
}
In the above -analyzer erroneously considers there to be a feasible execution
path in which IS_ERR(ptr) and PTR_ERR(err) == 0.
(minimized from a false positive in ipc/shm.c)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-06 18:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 18:27 [Bug analyzer/106218] New: Analyzer false positives with Linux kernel's err.h 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).