mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-09 20:08:11 +00:00
Merge pull request #6402 from bymehul/fix-6401-generic-cycle-deadlock
Fix generic cycle deadlock in struct layout
This commit is contained in:
@@ -4201,8 +4201,9 @@ gb_internal i64 type_align_of_internal(Type *t, TypePath *path) {
|
||||
if (t->Struct.is_packed) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
type_set_offsets(t);
|
||||
// Avoid forcing offset computation here. The caller's type-path state must
|
||||
// be able to detect recursive field cycles before any nested struct tries to
|
||||
// re-enter this struct's offset mutex.
|
||||
|
||||
i64 max = 1;
|
||||
for_array(i, t->Struct.fields) {
|
||||
|
||||
@@ -31,6 +31,7 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style -ignore-unused
|
||||
..\..\..\odin test ..\test_issue_6101.odin %COMMON% || exit /b
|
||||
..\..\..\odin test ..\test_issue_6165.odin %COMMON% || exit /b
|
||||
..\..\..\odin build ..\test_issue_6240.odin %COMMON% 2>&1 | find /c "Error:" | findstr /x "3" || exit /b
|
||||
..\..\..\odin build ..\test_issue_6401.odin %COMMON% 2>&1 | find /c "Error:" | findstr /x "3" || exit /b
|
||||
|
||||
@echo off
|
||||
|
||||
|
||||
@@ -43,6 +43,12 @@ else
|
||||
echo "SUCCESSFUL 0/1"
|
||||
exit 1
|
||||
fi
|
||||
if [[ $($ODIN build ../test_issue_6401.odin $COMMON 2>&1 >/dev/null | grep -c "Error:") -eq 3 ]] ; then
|
||||
echo "SUCCESSFUL 1/1"
|
||||
else
|
||||
echo "SUCCESSFUL 0/1"
|
||||
exit 1
|
||||
fi
|
||||
set +x
|
||||
|
||||
popd
|
||||
|
||||
16
tests/issues/test_issue_6401.odin
Normal file
16
tests/issues/test_issue_6401.odin
Normal file
@@ -0,0 +1,16 @@
|
||||
// Tests issue #6401 https://github.com/odin-lang/Odin/issues/6401
|
||||
package test_issues
|
||||
|
||||
Wrapper :: struct(T: typeid) {
|
||||
value: T,
|
||||
}
|
||||
|
||||
A :: struct {
|
||||
value: Wrapper(B),
|
||||
}
|
||||
|
||||
B :: struct {
|
||||
value: A,
|
||||
}
|
||||
|
||||
main :: proc() {}
|
||||
Reference in New Issue
Block a user