Skip to content

gen-c: 5912 errors are symbols referenced and never declared, and cast_i8 alone is 210 #3464

Description

@gHashTag

What the measurement says

I set out to type lists of calls, estimating ~92 errors from the shape count. The change removed one. The reason is the finding:

$ grep -rl 'cast_i8(' specs/ | wc -l      # 6 specs call it
$ grep -rl 'fn cast_i8'  specs/ | wc -l   # 0 declare it

fn_return_types has no entry, so a lookup-based inference correctly refuses. That refusal is not the problem — the missing declaration is.

Counted over the generated C corpus with -ferror-limit=0:

class count
use of undeclared identifier 3007
call to undeclared function 2057 (91 files)
unknown type name 848
total 5912

against 522 remaining in the __auto_type class I have spent three passes on. The undeclared-symbol family is more than ten times larger, and it was never counted because I was following one class rather than looking at the distribution.

Most-called undeclared functions:

210  cast_i8      142  len          76  compose      64  booth_mul_i32
 62  approximately_equal            58  adder_tree   52  random_input
 50  ternary_gemm

cast_i8 is not a user function

The compiler knows it. compiler.rs:9732 carries the note "integer cast. cast_i8( alone appears 1,100 times", and compiler.rs:5585 records that it is "never lowered ('use of undeclared identifier 'cast_i8'' from inside an emitted .{ cast_i8(42) })".

So it is a convention the parser understands and at least one backend does not emit. len is the same shape — Rust's .len() has a lowering, a bare len does not.

What has NOT been measured

Whether these split into causes: a compiler-known builtin never emitted (cast_i8, len), a function declared in another spec and reached through use, or a function declared nowhere at all. Those need different repairs and the counts above do not separate them. That separation is the next measurement, and it should come before any code — the same first move that turned 1729 __auto_type errors into three tractable problems and one impossible one.

What this issue does not claim

That 5912 errors would disappear. An undeclared symbol often cascades: one missing declaration silences and then reveals diagnostics about every use. The number is a population, not a prediction.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions