Skip to content

Conversation

@tautschnig
Copy link
Collaborator

@tautschnig tautschnig commented Dec 9, 2025

The existing tests provided basic const handling coverage, but several complex scenarios were not comprehensively tested. This PR addresses the following edge cases:

  1. Triple pointer const handling - int * const ** (const at middle level)
  2. Double const qualification - const int * const (both pointer and data const)
  3. Array of pointers to const - const int ** / const int *arr[]
  4. Const function pointers - func_ptr_t * const
  5. Nested struct const pointers - Mixed const/non-const in nested structures
  6. Combined qualifiers - volatile const int * (volatile + const interaction)
  7. Const array parameters - const int[] (array parameter const protection)
  8. Pointer to const struct - const struct test_struct * (struct-level const)
  9. Systematic const variations - Comprehensive test of const at each pointer level

Co-authored-by: Kiro autonomous agent

Fixes: #1948

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

…dling

The existing tests provided basic const handling coverage, but several
complex scenarios were not comprehensively tested. This PR addresses the
following edge cases:

1. **Triple pointer const handling** - `int * const **` (const at middle level)
2. **Double const qualification** - `const int * const` (both pointer and data const)
3. **Array of pointers to const** - `const int **` / `const int *arr[]`
4. **Const function pointers** - `func_ptr_t * const`
5. **Nested struct const pointers** - Mixed const/non-const in nested structures
6. **Combined qualifiers** - `volatile const int *` (volatile + const interaction)
7. **Const array parameters** - `const int[]` (array parameter const protection)
8. **Pointer to const struct** - `const struct test_struct *` (struct-level const)
9. **Systematic const variations** - Comprehensive test of const at each pointer level

Co-authored-by: Kiro autonomous agent

Fixes: diffblue#1948
@tautschnig tautschnig changed the title Add edge case regression tests for --generate-function-body const han… Add edge case regression tests for --generate-function-body const handling Dec 9, 2025
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.

Add additional regression tests for --replace-function-body

1 participant