From 2f68a64614bf41af17d2aaa0fa009b09dbe16c53 Mon Sep 17 00:00:00 2001 From: Samuel Elgozi Date: Sun, 23 Aug 2026 20:14:57 +0300 Subject: [PATCH 1/2] core:sys/darwin/Foundation: Skip Cocoa import on iOS --- core/sys/darwin/Foundation/objc.odin | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/sys/darwin/Foundation/objc.odin b/core/sys/darwin/Foundation/objc.odin index 82d6199ce..52832c43b 100644 --- a/core/sys/darwin/Foundation/objc.odin +++ b/core/sys/darwin/Foundation/objc.odin @@ -1,8 +1,10 @@ package objc_Foundation foreign import "system:Foundation.framework" -// NOTE: Most of our bindings are reliant on Cocoa (everything under appkit) so just unconditionally import it -@(require) foreign import "system:Cocoa.framework" +when !ODIN_PLATFORM_SUBTARGET_IOS { + // Most macOS bindings rely on Cocoa through AppKit. + @(require) foreign import "system:Cocoa.framework" +} import "base:intrinsics" import "core:c" From 2d1253e3e6a18339fff7fcb8f3f12de6c4beed19 Mon Sep 17 00:00:00 2001 From: mo Date: Mon, 24 Aug 2026 09:33:26 +1200 Subject: [PATCH 2/2] add regression test for #7336 Closes #7336. Fixed by #7327. --- tests/issues/run.bat | 1 + tests/issues/run.sh | 1 + tests/issues/test_issue_7336.odin | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/issues/test_issue_7336.odin diff --git a/tests/issues/run.bat b/tests/issues/run.bat index f211e153b..f57aa14c2 100644 --- a/tests/issues/run.bat +++ b/tests/issues/run.bat @@ -44,6 +44,7 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style -ignore-unused ..\..\..\odin check ..\test_issue_7012.odin -no-entry-point %COMMON% || exit /b ..\..\..\odin check ..\test_issue_7260.odin -no-entry-point %COMMON% || exit /b ..\..\..\odin test ..\test_issue_bool_comparison_truthiness.odin %COMMON% || exit /b +..\..\..\odin check ..\test_issue_7336.odin -no-entry-point %COMMON% || exit /b ..\..\..\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 diff --git a/tests/issues/run.sh b/tests/issues/run.sh index 16133d72d..560218c1d 100755 --- a/tests/issues/run.sh +++ b/tests/issues/run.sh @@ -93,6 +93,7 @@ $ODIN check ../test_issue_7012.odin -no-entry-point $COMMON_CHECK $ODIN build ../test_issue_7037.odin $COMMON -o:none $ODIN check ../test_issue_7429.odin $COMMON_CHECK $ODIN test ../test_issue_7356.odin $COMMON +$ODIN test ../test_issue_7336.odin $COMMON $ODIN build ../test_issue_7167.odin $COMMON $ODIN build ../test_issue_7188.odin $COMMON $ODIN check ../test_issue_7260.odin -no-entry-point $COMMON_CHECK diff --git a/tests/issues/test_issue_7336.odin b/tests/issues/test_issue_7336.odin new file mode 100644 index 000000000..305b4a974 --- /dev/null +++ b/tests/issues/test_issue_7336.odin @@ -0,0 +1,20 @@ +// Tests issue #7336 https://github.com/odin-lang/Odin/issues/7336 +package test_issues + +import "core:testing" + +S :: struct { + a: [dynamic; 1]matrix[4, 4]f32, + b: matrix[4, 4]f32, +} + +@(test) +test_offset :: proc(t: ^testing.T) { + s := new(S) + defer free(s) + + // 4*4 f32 + dynamic len == 72 + expect: uintptr = 4 * 4 * 4 + size_of(int) + testing.expect(t, offset_of(S, b) == expect) + testing.expect(t, uintptr(rawptr(&s.b)) - uintptr(rawptr(s)) == expect) +}