Skip to content

Correction: Update SPARK examples for GNAT FSF 16 - #1402

Merged
gusthoff merged 4 commits into
AdaCore:mainfrom
gusthoff:dev/topic/content/general/gnat-16-update/spark-examples/2026-11-13
Nov 20, 2026
Merged

gusthoff merged 4 commits into
AdaCore:mainfrom
gusthoff:dev/topic/content/general/gnat-16-update/spark-examples/2026-11-13

Conversation

@gusthoff

Copy link
Copy Markdown
Collaborator

Enable compilation and flow analysis with the default toolchain for
the semicolon and abstract-state examples.

Qualify the invalid abstract-state operands with Element_Array so
GNAT and GNATprove report the intended errors instead of crashing.
Keep the semicolon source unchanged and add a short note explaining
its unproved termination check and the Loop_Variant that resolves it.

Remove unused GNAT 12 and 14 and GNATprove 12 from the installation
list. Retain GNAT/GNATprove 15 and GPRbuild 25 for the two unchanged
ring-buffer examples: version 16 misses the ghost-use errors they
demonstrate.

Validation:

  • Checked the affected examples with GNAT/GNATprove 16.
  • Confirmed the ring-buffer ghost-use errors with GNAT/GNATprove 15.
  • Passed all 18 toolchain configuration tests and checked that every
    explicit content pin is covered by the configured versions.

Co-Authored-By: Codex noreply@openai.com

gusthoff and others added 3 commits November 13, 2026 13:07
- Restore compilation and flow analysis with `--report=all` using the
  default toolchain.
- Expect the termination diagnostic for the original loop.

Co-Authored-By: Codex <noreply@openai.com>
- Qualify the comparison with `Element_Array` so GNAT and GNATprove
  report ordinary errors for using abstract state as a value.
- Restore compilation and flow analysis with the default toolchain.

Co-Authored-By: Codex <noreply@openai.com>
Add a short note after the semicolon example to explain the loop
termination diagnostic and the `Loop_Variant` that resolves it.

Validated with GNATprove 16: the original loop reports an unproved
`Always_Terminates` check. Adding
`pragma Loop_Variant (Decreases => 1)` proves the check.

Co-Authored-By: Codex <noreply@openai.com>
Add `pragma Loop_Variant (Decreases => 1)` to the loop and remove
`ada-expect-prove-error` now that GNATprove proves termination.
Explain in one sentence that a constant variant rules out a second
iteration.

Validated all 10 code blocks in the syntactic guarantees chapter with
GNAT/GNATprove 16 and the course's 80-column limit.

Co-Authored-By: Codex <noreply@openai.com>
@gusthoff
gusthoff requested a review from clairedross November 13, 2026 17:19
@gusthoff
gusthoff merged commit c9ba349 into AdaCore:main Nov 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants