From 366c33e5afc336986cd0c5848ddabb23a7c38e03 Mon Sep 17 00:00:00 2001 From: kalsprite Date: Sun, 23 Aug 2026 23:17:55 -0700 Subject: [PATCH 1/2] Delete dead code that crashed the checker on an asm template group with no parameters --- src/types.cpp | 8 ----- tests/issues/run.bat | 1 + tests/issues/run.sh | 10 +++++++ .../test_issue_asm_group_empty_params.odin | 29 +++++++++++++++++++ 4 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 tests/issues/test_issue_asm_group_empty_params.odin diff --git a/src/types.cpp b/src/types.cpp index d12d8dbee..54481098b 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -3722,14 +3722,6 @@ gb_internal ProcTypeOverloadKind are_proc_types_overload_safe(Type *x, Type *y) return ProcOverload_TargetFeatures; } - if (px.params != nullptr && py.params != nullptr) { - Entity *ex = px.params->Tuple.variables[0]; - Entity *ey = py.params->Tuple.variables[0]; - bool ok = are_types_identical(ex->type, ey->type); - if (ok) { - } - } - return ProcOverload_Identical; } diff --git a/tests/issues/run.bat b/tests/issues/run.bat index 4cbb424b4..4978b146e 100644 --- a/tests/issues/run.bat +++ b/tests/issues/run.bat @@ -46,6 +46,7 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style -ignore-unused ..\..\..\odin check ..\test_issue_ellipsis_type_call.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "10" || exit /b ..\..\..\odin check ..\test_issue_foreign_redeclaration.odin -no-entry-point %COMMON% || exit /b ..\..\..\odin check ..\test_issue_foreign_redeclaration_mismatch.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "1" || exit /b +..\..\..\odin check ..\test_issue_asm_group_empty_params.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "3" || exit /b ..\..\..\odin build ..\test_issue_7037.odin %COMMON% -o:none || exit /b ..\..\..\odin build ..\test_issue_7188.odin %COMMON% || exit /b clang -c ..\test_issue_sysv_abi.c -o test_issue_sysv_abi_c.o || exit /b diff --git a/tests/issues/run.sh b/tests/issues/run.sh index 98c144d9c..3d3746339 100755 --- a/tests/issues/run.sh +++ b/tests/issues/run.sh @@ -110,6 +110,16 @@ else exit 1 fi +# `asm` templates are amd64-only, so this file is empty on every other architecture +if [[ "$(uname -m)" == "x86_64" || "$(uname -m)" == "amd64" ]]; then + if [[ $($ODIN check ../test_issue_asm_group_empty_params.odin -no-entry-point $COMMON_CHECK 2>&1 >/dev/null | grep -c "Error:") -eq 3 ]]; then + echo "SUCCESSFUL 1/1" + else + echo "SUCCESSFUL 0/1" + exit 1 + fi +fi + if [[ $($ODIN build ../test_issue_7108.odin $COMMON 2>&1 >/dev/null | grep -c "Error:") -eq 2 ]]; then echo "SUCCESSFUL 1/1" else diff --git a/tests/issues/test_issue_asm_group_empty_params.odin b/tests/issues/test_issue_asm_group_empty_params.odin new file mode 100644 index 000000000..f35dcf0af --- /dev/null +++ b/tests/issues/test_issue_asm_group_empty_params.odin @@ -0,0 +1,29 @@ +#+build amd64 +// A zero-parameter asm template carries a non-null but empty parameter tuple, unlike a +// zero-parameter procedure, so dead code at the end of `are_proc_types_overload_safe` indexed +// `variables[0]` on it and tripped the bounds assertion. The duplicate-signature diagnostic the +// checker was about to print was lost, and the crash arrived with nothing else on stderr. +package test_issues + +nop_a :: asm() { nop; } +nop_b :: asm() { nop; } +dup_no_params :: asm { nop_a, nop_b } + +out_a :: asm() -> (r: u64) [r = %rax] { nop; } +out_b :: asm() -> (r: u64) [r = %rax] { nop; } +dup_result_only :: asm { out_a, out_b } + +three_a :: asm() { nop; } +three_b :: asm() { nop; } +three_c :: asm() { nop; } +dup_three :: asm { three_a, three_b, three_c } + +// a group whose members differ in their parameters has to keep resolving cleanly +add32 :: asm(a: u32, b: u32) -> (r: u32) { mov r, a; add r, b; } +add64 :: asm(a: u64, b: u64) -> (r: u64) { mov r, a; add r, b; } +add_ok :: asm { add32, add64 } + +use :: proc() { + _ = add_ok(u32(20), u32(22)) + _ = add_ok(u64(1), u64(2)) +} From ddffec5c9706b86bea2cdb76c1a5f3e64dc4f411 Mon Sep 17 00:00:00 2001 From: kalsprite Date: Mon, 24 Aug 2026 17:55:12 -0700 Subject: [PATCH 2/2] remove the asm group error-count test --- tests/issues/run.bat | 1 - tests/issues/run.sh | 6 ---- .../test_issue_asm_group_empty_params.odin | 29 ------------------- 3 files changed, 36 deletions(-) delete mode 100644 tests/issues/test_issue_asm_group_empty_params.odin diff --git a/tests/issues/run.bat b/tests/issues/run.bat index 67fa39723..d31751a87 100644 --- a/tests/issues/run.bat +++ b/tests/issues/run.bat @@ -47,7 +47,6 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style -ignore-unused ..\..\..\odin check ..\test_issue_ellipsis_type_call.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "10" || exit /b ..\..\..\odin check ..\test_issue_foreign_redeclaration.odin -no-entry-point %COMMON% || exit /b ..\..\..\odin check ..\test_issue_foreign_redeclaration_mismatch.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "1" || exit /b -..\..\..\odin check ..\test_issue_asm_group_empty_params.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "3" || exit /b ..\..\..\odin check ..\test_issue_asm_rip_register.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "6" || exit /b ..\..\..\odin check ..\test_issue_asm_template_as_value.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "10" || exit /b ..\..\..\odin build ..\test_issue_7037.odin %COMMON% -o:none || exit /b diff --git a/tests/issues/run.sh b/tests/issues/run.sh index d50961959..b936a9e30 100755 --- a/tests/issues/run.sh +++ b/tests/issues/run.sh @@ -122,12 +122,6 @@ fi # `asm` templates are amd64-only, so this file is empty on every other architecture if [[ "$(uname -m)" == "x86_64" || "$(uname -m)" == "amd64" ]]; then - if [[ $($ODIN check ../test_issue_asm_group_empty_params.odin -no-entry-point $COMMON_CHECK 2>&1 >/dev/null | grep -c "Error:") -eq 3 ]]; then - echo "SUCCESSFUL 1/1" - else - echo "SUCCESSFUL 0/1" - exit 1 - fi if [[ $($ODIN check ../test_issue_asm_rip_register.odin -no-entry-point $COMMON_CHECK 2>&1 >/dev/null | grep -c "Error:") -eq 6 ]]; then echo "SUCCESSFUL 1/1" else diff --git a/tests/issues/test_issue_asm_group_empty_params.odin b/tests/issues/test_issue_asm_group_empty_params.odin deleted file mode 100644 index f35dcf0af..000000000 --- a/tests/issues/test_issue_asm_group_empty_params.odin +++ /dev/null @@ -1,29 +0,0 @@ -#+build amd64 -// A zero-parameter asm template carries a non-null but empty parameter tuple, unlike a -// zero-parameter procedure, so dead code at the end of `are_proc_types_overload_safe` indexed -// `variables[0]` on it and tripped the bounds assertion. The duplicate-signature diagnostic the -// checker was about to print was lost, and the crash arrived with nothing else on stderr. -package test_issues - -nop_a :: asm() { nop; } -nop_b :: asm() { nop; } -dup_no_params :: asm { nop_a, nop_b } - -out_a :: asm() -> (r: u64) [r = %rax] { nop; } -out_b :: asm() -> (r: u64) [r = %rax] { nop; } -dup_result_only :: asm { out_a, out_b } - -three_a :: asm() { nop; } -three_b :: asm() { nop; } -three_c :: asm() { nop; } -dup_three :: asm { three_a, three_b, three_c } - -// a group whose members differ in their parameters has to keep resolving cleanly -add32 :: asm(a: u32, b: u32) -> (r: u32) { mov r, a; add r, b; } -add64 :: asm(a: u64, b: u64) -> (r: u64) { mov r, a; add r, b; } -add_ok :: asm { add32, add64 } - -use :: proc() { - _ = add_ok(u32(20), u32(22)) - _ = add_ok(u64(1), u64(2)) -}