google / google/xls

RET_CHECK internal failure when parametric is a type instead of expected value

Open
#2,917 2 comments 0 reactions 0 assignees View on GitHub
dslx
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

**Describe the bug**
XLS crashes when converting my DSLX code.

**To Reproduce**

```bash
root@machine:~/xls-v0.0.0-8501-gfc7c0e31f-linux-x64$ cat a.x
import fixed_point;

pub fn f(sum1: sN[24]) -> (fixed_point::FixedPoint) {
fixed_point::make_fixed_point(sum1);
}

root@machine:~/xls-v0.0.0-8501-gfc7c0e31f-linux-x64$ ./ir_converter_main a.x
E0821 04:46:15.325163 2022218 deduce.cc:1720] INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/deduce.cc:1720) std::holds_alternative(eot)
0x5df1c06c2468: xabsl::StatusBuilder::CreateStatusAndConditionallyLog()
0x5df1c02dc0f9: absl::lts_20250512::StatusOr<>::StatusOr<>()
0x5df1c02eb379: xls::dslx::(anonymous namespace)::DeduceVisitor::HandleTypeRefTypeAnnotation()
0x5df1c05c1f2b: xls::dslx::TypeRefTypeAnnotation::Accept()
0x5df1c02dba7f: xls::dslx::Deduce()
0x5df1c02d85e5: std::__1::__function::__func<>::operator()()
0x5df1c047020c: xls::dslx::DeduceCtx::Deduce()
0x5df1c02e9d5c: xls::dslx::(anonymous namespace)::DeduceVisitor::HandleTupleTypeAnnotation()
0x5df1c05c3dbb: xls::dslx::TupleTypeAnnotation::Accept()
0x5df1c02dba7f: xls::dslx::Deduce()
0x5df1c02d85e5: std::__1::__function::__func<>::operator()()
0x5df1c047020c: xls::dslx::DeduceCtx::Deduce()
0x5df1c047103c: xls::dslx::DeduceCtx::DeduceAndResolve()
0x5df1c02d8dbf: xls::dslx::TypecheckFunction()
0x5df1c02d4e7d: std::__1::__variant_detail::__visitation::__base::__dispatcher<>::__dispatch[abi:ne190107]<>()
0x5df1c02d364f: xls::dslx::typecheck_internal::TypecheckModuleMember()
0x5df1c02d3edc: xls::dslx::TypecheckModule()
0x5df1c02d2cdb: xls::dslx::TypecheckModule()
0x5df1c024a5ff: xls::dslx::ConvertFilesToPackage()
0x5df1c01f795f: main
0x7a8f558a01ca: [unknown]
0x7a8f558a028b: __libc_start_main
0x5df1c01f71e5: _start

E0821 04:46:15.325243 2022218 command_line_utils.cc:50] Could not extract a textual position from error message: INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/deduce.cc:1720) std::holds_alternative(eot) : INVALID_ARGUMENT: Provided status is not in recognized error form: INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/deduce.cc:1720) std::holds_alternative(eot)
Error: INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/deduce.cc:1720) std::holds_alternative(eot)

root@machine:~/xls-v0.0.0-8501-gfc7c0e31f-linux-x64$ distro
Name: Ubuntu 24.04.1 LTS
Version: 24.04 (noble)
Codename: noble
```

**Expected behavior**
The compiler should not crash.

**Environment (this can be helpful for troubleshooting):**
Ubuntu 24.04

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.