Skip to content

Map generic formal inputs in generated globals - #67

Open
truemagic-coder wants to merge 1 commit into
AdaCore:masterfrom
truemagic-coder:agent/fix-generated-generic-in-globals
Open

Map generic formal inputs in generated globals#67
truemagic-coder wants to merge 1 commit into
AdaCore:masterfrom
truemagic-coder:agent/fix-generated-generic-in-globals

Conversation

@truemagic-coder

Copy link
Copy Markdown

Fixes #62.

GNATprove can miscompute generated Global contracts when a generic formal object of mode in is used inside an instance. When the generated contract is queried outside the instance, the instance-local constant can escape instead of being mapped back to the object referenced by the generic actual, resulting in an incorrect Global diagnostic and Program_Error.

This PR:

  • maps generic formal in objects in generated Proof_Ins and Inputs back to their actual expressions;
  • uses the same generic-formal mapping already applied to explicit Global contracts;
  • adds the original reproducer as a regression test;
  • adds nearby cases covering literal, constant, and in out generic actuals;
  • documents the generated-contract behavior.

Verification

The exact submitted commit was independently verified with FalseGreen against a frozen verification contract.

  • the modified gnat2why dependency closure was rebuilt from source with prior build outputs removed;
  • verification used only the newly source-built gnat2why;
  • 2/2 original-reproducer and 9/9 nearby proof obligations were discharged;
  • 0 unproved or justified obligations;
  • 0 SARIF errors and 0 unknown warnings;
  • exactly two unrelated warnings matched the frozen allowlist;
  • 2/2 verification criteria passed;
  • verified source: 92565c8f0e744c4df2d4228ae0309ea9791e377a.

The verification is scoped to these criteria and does not claim broader correctness of GNATprove. Because a matching internal GNAT frontend for current master is not publicly available, the source-built verification used the public fsf-16 source-equivalent target while binding the submitted product files to the exact commit above.

Assisted-by: Codex

@CLAassistant

CLAassistant commented Aug 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@truemagic-coder
truemagic-coder marked this pull request as ready for review August 17, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GNATprove miscomputes Global aspect for generic formal parameter

2 participants