Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RET_CHECK failure when reporting unused variable #1681

Open
mikex-oss opened this issue Oct 31, 2024 · 0 comments
Open

RET_CHECK failure when reporting unused variable #1681

mikex-oss opened this issue Oct 31, 2024 · 0 comments
Labels
dslx DSLX (domain specific language) implementation / front-end

Comments

@mikex-oss
Copy link
Collaborator

Describe the bug
As part of creating a repro for a separate issue, hit this ret check:

E1031 10:28:17.363165 1824 warn_on_defined_but_unused.cc:98] INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/warn_on_defined_but_unused.cc:98) type.has_value() NameDef result 0x72e6bfe5e3a8 @ foo.x:6:21-6:27 parent kind name definition tree had no associated type information in type info 0x72e6bfe58118

To Reproduce

import std;

fn foo() -> u32 {
    for (_, result): (u32, u32) in range(u32:0, u32:10) {
        unroll_for! (j, result): (u32, u32) in range(u32:0, u32:10) {
            for (k, result): (u32, u32) in range(u32:0, std::upow(u32:2, j)) {
                k
            }(result)
        }(result)
    }(u32:0)
}

Expected behavior
The most inner result should be gracefully reported as defined but unused.

Additional context
Full stack trace:

E1031 10:28:17.363165 1824 warn_on_defined_but_unused.cc:98] INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/warn_on_defined_but_unused.cc:98) type.has_value() NameDef result 0x72e6bfe5e3a8 @ foo.x:6:21-6:27 parent kind name definition tree had no associated type information in type info 0x72e6bfe58118
=== Source Location Trace: ===
xls/common/status/status_builder.cc:197

0x55bd76f91341: xabsl::StatusBuilder::CreateStatusAndConditionallyLog()
0x55bd73e5982b: xls::dslx::WarnOnDefinedButUnused()
0x55bd73e1e806: xls::dslx::TypecheckFunction()
0x55bd73e1704e: xls::dslx::TypecheckModule()
0x55bd73db1d2d: xls::dslx::TypecheckModule()
0x55bd73db13ca: xls::dslx::ParseAndTypecheck()
0x55bd73da8bfc: xls::dslx::AbstractTestRunner::ParseAndTest()
0x55bd73d73cd9: main
0x7f08ebb433d4: __libc_start_main
0x55bd73d7202a: _start
E1031 10:28:17.363286 1824 command_line_utils.cc:50] Could not extract a textual position from error message: INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/warn_on_defined_but_unused.cc:98) type.has_value() NameDef result 0x72e6bfe5e3a8 @ foo.x:6:21-6:27 parent kind name definition tree had no associated type information in type info 0x72e6bfe58118
=== Source Location Trace: ===
xls/common/status/status_builder.cc:197
xls/dslx/type_system/warn_on_defined_but_unused.cc:98
xls/dslx/type_system/typecheck_function.cc:256
xls/dslx/type_system/typecheck_module.cc:258
xls/dslx/parse_and_typecheck.cc:97
: INVALID_ARGUMENT: Provided status is not in recognized error form: INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/warn_on_defined_but_unused.cc:98) type.has_value() NameDef result 0x72e6bfe5e3a8 @ foo.x:6:21-6:27 parent kind name definition tree had no associated type information in type info 0x72e6bfe58118
=== Source Location Trace: ===
xls/dslx/frontend/bindings.cc:55
Error: INTERNAL: XLS_RET_CHECK failure (xls/dslx/type_system/warn_on_defined_but_unused.cc:98) type.has_value() NameDef result 0x72e6bfe5e3a8 @ foo.x:6:21-6:27 parent kind name definition tree had no associated type information in type info 0x72e6bfe58118
=== Source Location Trace: ===
xls/common/status/status_builder.cc:197
xls/dslx/type_system/warn_on_defined_but_unused.cc:98
xls/dslx/type_system/typecheck_function.cc:256
xls/dslx/type_system/typecheck_module.cc:258
xls/dslx/parse_and_typecheck.cc:97
xls/dslx/interpreter_main.cc:199
Error parsing and type checking DSLX source file: foo.x

@mikex-oss mikex-oss added the dslx DSLX (domain specific language) implementation / front-end label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dslx DSLX (domain specific language) implementation / front-end
Projects
Status: No status
Development

No branches or pull requests

1 participant