[Bug analyzer/109191] GCC static analyzer does not warning `*b = 1` where `b` is 1.

2024-02-15 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109191

David Malcolm  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from David Malcolm  ---
Resolving as "INVALID"; feel free to reopen if there's a response to the above
questions.

[Bug analyzer/109191] GCC static analyzer does not warning `*b = 1` where `b` is 1.

2023-03-20 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109191

--- Comment #2 from David Malcolm  ---
It is valid in the embedded space to do things like

   *(SOME_CONSTANT_ADDRESS) = SOME_VALUE;

[Bug analyzer/109191] GCC static analyzer does not warning `*b = 1` where `b` is 1.

2023-03-20 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109191

--- Comment #1 from David Malcolm  ---
GCC does emit a -Wint-to-pointer-cast warning on this code, for the int to void
* conversion.

Is this reduced from a real-world example, or just synthesized by hand?

I suppose in theory the analyzer could:

(a) figure out that it reads all zeroes from the array and complain about the
null pointer deref, and/or

(b) complain that we're accessing beyond the end of an array