CI: FastC primitive comparison synthetic-token memo reuse emits an unrelated mixed-sign helper (GCC ASan)

Open
#32,762 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c, cpp
Domain
compilers

Research direction

Start with the failing test test_fastc_plain_primitive_comparisons_preserve_mixed_sign_helpers_and_reject_complex_shapes in vlib/v/gen/fastc/primitive_comparison_test.v around line 101, then read fastc_comparison_memo_key in vlib/v/gen/fastc/fastc.v and the memo reset in expr.v. Done means the test passes under GCC ASan without changing its assertions, by resetting the memo between synthetic cases or using a fresh Parser per case.

Written by the indexing model from the issue text.

Description

Executed historical failure

  • Master 593657221cd2ef2063d41979a7b827e8cb12ecd5, GCC AddressSanitizer shard 3, completed 2026-11-22 21:55:59 UTC after 498 other tests passed and 172 skipped.
  • vlib/v/gen/fastc/primitive_comparison_test.v:101 fails test_fastc_plain_primitive_comparisons_preserve_mixed_sign_helpers_and_reject_complex_shapes for f == a (f: f64, a: int). Expected render_special_expression(...) == none, but got v_fastc_us_eq((u64)(wide), (i64)(a)), from a different previous case, not a float comparison.

Investigation and likely root

  • fastc_comparison_memo_key in vlib/v/gen/fastc/fastc.v:1812–1830 keys only by token-array data pointer, count and tag. The renderer memo is cleared by read_expression_with_continuation_mode in expr.v:238–252 at each production top-level expression.
  • The test creates and frees multiple independent synthetic token arrays while reusing the same Parser and directly calling render_special_expression; that bypasses the production memo reset and can reuse a freed token buffer's address. The stale wide source in the actual output strongly confirms a cross-case memo hit.
  • Current master 44bbfa43 did not change these functions; no evidence that the normal expression reader produces the same wrong result. Check test and production separately.

Repair / validation

Reset comparison/type memo between independently synthesized test expressions, or use a fresh Parser per case, without changing any assertion; retain coverage for real recursive subranges while one expression lives. Test old-vs-new with GCC ASan and unsuppressed Clang ASan plus ./v self, formatting, focused FastC/primitive comparison suite. Inspect any actual runtime numeric comparisons before touching implementation. Source-based diagnosis only; corrected V native run has not happened.

Normalized root: R395, investigating; first/last observed 2026-11-22 21:55 UTC; failing SHA predates current task merge. An old red job alone does not establish introduction.

[!NOTE]
You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Dominant language
V
Stars
38.1k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
682

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vlang/v

All issues in vlang/v

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.