Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

False error: array length is not known to be non-negative

オープン
#404 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
compilers

調査の方向性

The bug is in how length(x) is encoded for the SMT solver, which the payload does not locate, so start by finding where array length is translated. Use the reproducer's size method with @Refinement("_ >= 0") as the test case. Done when that snippet prints Correct! Passed Verification. and existing tests still pass.

索引モデルが issue の本文から書いたものです。

説明

bug

Impact: correct code is rejected (false error).

Description

length(x) is not known to be non-negative, so the solver picks a negative length. Any refinement that needs length(a) >= 0 must be written out by hand.

Minimal reproducer

import liquidjava.specification.Refinement;

class Len {
    @Refinement("_ >= 0")
    static int size(int[] names) {
        return names.length;
    }
}

Expected

Correct! Passed Verification.

Actual (main ad055b49)

Refinement Error: #ret⁰ == length(names) is not a subtype of #ret⁰ >= 0
 --> Counterexample: names == ((as const (Array Int Int)) (- 1)) && #ret⁰ == -1

Possible fix

Assume length(x) >= 0 for every array variable when it enters the context, or add the axiom in the SMT translation of length.

主要言語
Java
スター
69
フォーク
36
平均マージ
2日 1時間
マージ済み PR(30日)
35

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

liquid-java/liquidjava のほかの issue

liquid-java/liquidjava の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。