analyzer
analyzer copied to clipboard
Refactor writing to pointers
- Removes dead code that indicates as if we are not writing to known addresses if a pointer contains an unknown element, solves #1461
- Fixes issue #1465, and replaces complicated set logic with simplified AD.fold, for that:
- Asserts that the set of
lval-s is not empty when written to - Does not remove
NullPtr-s from address sets incollect_invalidateandreachable_from_value#1175 - Fixes a regression test by including
stdlib.hfor correctly importing strtol
- Asserts that the set of
- does not remove
UnknownPtrbefore callingreachable_varsinReachableFrom#1175
TODO
- [ ] Test #1562.
Decisions from GobCon on 09.07:
What should happen when we write to a pointer that is either known or NullPtr?
- a) Should we keep the NullPtr and join the known values
- b) Or should we assume that if it is null, the program crashes anyways, and if it continues, the known value can only be the one that was written
- [ ] Add b) as default behavior, make it configurable (for now), with option called
sem.abort-on-null-deref
We already have the option sem.null-pointer.dereference (for reading) and I think we decided to reuse that for writing. Its name and values might need to be changed though to match both reading and writing.
This seems to have gotten stuck. Are there plans here?
There was the matter of naming/describing the option but we discussed it and something seems to have been implemented. Not sure about the test failures though.
I think it makes sense to do this though.