Skip to content

Reference-typed constant arguments trigger "unsupported constant type" errors #1549

@lynae99

Description

@lynae99

Passing a reference to a constant literal, such as &(0), causes Prusti to reject the program with an unsupported constant type error. This prevents verification of otherwise simple programs that use reference-typed arguments.
To Reproduce

fn test(x: u64, y: &u64) -> u64 {
    let y = *y;
    x / y
}

fn main() {
    test(1, &(0));
}

Actual Behavior
Prusti reports the following errors:

  1. error: [Prusti: unsupported feature] unsupported constant type &'?5 u64
  2. error: [Prusti: verification error] assertion might fail with "attempt to divide by zero"

Expected Behavior
Prusti should support reference-typed constant arguments such as &(0), instead of rejecting them as an unsupported constant type.
In this example, the relevant verification outcome is the division-by-zero error after dereferencing y. The reference constant itself should not prevent verification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions