Skip to content

validate-all and audit:all are silent when a body's parameter locals disagree with its signature (call argument types unchecked) #1735

Closed

Description

@ehartford

The deep-debugging tools stayed silent on a direct call whose argument types do not match the callee body's parameter locals.

Found on branch gen-push-fixes (#1724): the generator constructor for a gen mut fn tick(times: i32) allocated a temporary between its parameter locals, so times was read from a &Counter slot and the loop ran zero times. with check --validate-all printed validate-all: ok and with analyze … audit:all reported violations=0. MIR dump:

fn Counter.tick {
  _1: ty236  // self
  _2: ty971  // a temp (&Counter) — but n_params = 2, so this is parameter 2
  _3: ty3    // times

The typed validator checks a GENERIC_CALL's missing borrow (mir_validate_call_missing_borrow) and indirect-call arity, but never compares a direct call's argument operand types with the callee body's local_type_ids[1..=n_params], nor a body's parameter locals with its own signature's parameter types.

Expected: validate-all fails on a body whose parameter locals disagree with its signature (or a call whose arguments disagree with its callee's parameters), naming the body and parameter. The constructor bug itself is fixed in 06957a94 on gen-push-fixes; the tool gap remains.

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