Skip to content

Disable OOB checks during reachability calculations#2022

Merged
sim642 merged 2 commits into
masterfrom
reach-oob-checks
May 8, 2026
Merged

Disable OOB checks during reachability calculations#2022
sim642 merged 2 commits into
masterfrom
reach-oob-checks

Conversation

@karoliineh
Copy link
Copy Markdown
Member

Reachability computation in Base.reachable_from_addr uses the normal value read path via get_addr -> get_mval -> VD.eval_offset. For array-backed addresses, this goes through CArrays.get, which performs array OOB checks.

That is the wrong behavior for reachability: the analysis is only trying to inspect the immediate contents of a cell to discover embedded pointers, not to report an actual dereference. On zero-length VLAs this triggered array_oob_check during function-entry reachability handling. This was found using the dashboard comparison between Goblint and Mopsa and was exposed by the SV-COMP task ldv-memsafety/ArraysOfVariableLength2.c

Changes:

  • Added a regression extracted from ldv-memsafety/ArraysOfVariableLength2.c
  • Added an optional checkBounds flag to VD.eval_offset, threads it through get_mval and get_addr, and uses checkBounds=false specifically in reachable_from_addr. Normal semantic reads still keep bounds checks enabled.
  • Unrelated to the discovered bug, also added ~checkBounds:false to all ValueDomain.CArrays.get calls within the functions that calculate reachability.

@karoliineh karoliineh marked this pull request as draft May 6, 2026 11:50
@karoliineh karoliineh self-assigned this May 6, 2026
@karoliineh karoliineh added bug sv-comp SV-COMP (analyses, results), witnesses precision labels May 6, 2026
@karoliineh karoliineh added this to the SV-COMP 2027 milestone May 6, 2026
@karoliineh karoliineh marked this pull request as ready for review May 6, 2026 14:32
@sim642
Copy link
Copy Markdown
Member

sim642 commented May 7, 2026

I wonder if the whole reachability calculation should just be under executing_speculative_computations and the OOB warnings suppressed when speculating, similarly to the overflow ones.

@michael-schwarz
Copy link
Copy Markdown
Member

I wonder if the whole reachability calculation should just be under executing_speculative_computations and the OOB warnings suppressed when speculating, similarly to the overflow ones.

That sounds like a good idea!

Comment thread tests/regression/25-vla/07-zero-arg-reach.c Outdated
@sim642 sim642 force-pushed the reach-oob-checks branch from e732cd2 to 3ef1233 Compare May 8, 2026 07:36
@sim642 sim642 merged commit 48007a8 into master May 8, 2026
18 of 19 checks passed
@sim642 sim642 deleted the reach-oob-checks branch May 8, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug precision sv-comp SV-COMP (analyses, results), witnesses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants