mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-28 16:01:31 +00:00
Delete dead code that crashed the checker on an asm template group with no parameters
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
29
tests/issues/test_issue_asm_group_empty_params.odin
Normal file
29
tests/issues/test_issue_asm_group_empty_params.odin
Normal file
@@ -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))
|
||||
}
|
||||
Reference in New Issue
Block a user