Repository navigation
[AUTOMATED] Cast pointer values assigned to integer frame members - #1241
Merged
mahaloz merged 7 commits intoOct 22, 2026
Merged
Conversation
The PE32 cases compiled the sample for i686-w64-windows-gnu with `#include <stdint.h>`, which needs a MinGW sysroot; on a host whose clang has no such headers the three PE32 tests failed instead of exercising kuna. Use the compiler's builtin `__UINTPTR_TYPE__` so the freestanding sample needs no target headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
…NULL as 0 A pointer addition or member address assigned to integer storage still printed without a cast (`frame[0] = &value[1];`), which gcc 15 and clang reject. Treat PTRADD and PTRSUB statements like pointer copies. A copied variable whose own declaration is an integer gained a redundant cast (`cout = (unsigned long)cstart;` with `unsigned long cstart`); skip it when the source variable is declared as a non-pointer. A null pointer constant copied into integer storage now prints as `0` instead of `(long)NULL`. Adds two derived-pointer round-trip cases to the pointer-slot test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
Contributor
|
[AUTOMATED] Pushed three commits on top of this branch:
|
mahaloz
added a commit
to thotypous/kuna
that referenced
this pull request
Oct 22, 2026
…headers from the test The fallback member lookup preferred the high's mapped Symbol type for every variable. For a scalar local or global that type can differ from the type its declaration prints (tar _help declares `unsigned long v50` but its Symbol is `hol *`; a named global is declared at the type its accesses print), so the pointer cast that Noelo-Lab#1241 added (`v50 = (unsigned long)v22;`, `current_block = (long)v6;`) was dropped again and the C stopped compiling. Use the Symbol type only when it is a structure, array or union, where the declaration representative covers just the field. The printer test now uses __UINTPTR_TYPE__ instead of <stdint.h>, so the PE32 compile does not need a mingw sysroot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
mahaloz
added a commit
to thotypous/kuna
that referenced
this pull request
Oct 22, 2026
…to fix/integer-to-pointer-slots Resolve kuna_pointerstorecast.rs: match COPY, CAST, PTRADD and PTRSUB; keep this branch's CAST result type, widened source filter and two-way tail; keep Noelo-Lab#1241's early return for a COPY whose input is declared a non-pointer, but only when the source is a pointer, so it does not block the integer-to-pointer COPY case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
The declared-non-pointer skip dropped the cast whenever the copied variable's declaration was not a pointer. A source declared as a record prints as the pointer member it reads, so `long x = (long)w.p;` with a `W w` parameter printed `x = w.p;`, which gcc 15 rejects. Skip the cast only when the source is declared as a same-width integer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
Contributor
|
[AUTOMATED] Pushed c009e52 (plus a merge of origin/main, 8863f8f, which resolves the The f1d1518 skip of the cast for a source variable declared as a non-pointer also dropped it for a source declared as a record. Such a source prints as the pointer member it reads, so |
mahaloz
added a commit
to thotypous/kuna
that referenced
this pull request
Oct 22, 2026
Noelo-Lab#1241 landed as a squash; this re-applies only Noelo-Lab#1249's own changes on top of main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A declared pointer copied into an integer frame member can print as
frame[0] = value;, which Clang rejects. On x86-64 Linux, run from the repository root:frame[0] = (unsigned long)value;; preserve numeric conversions,nocasts, and other output languages.Six focused Clang PE32/ELF64 array/record cases pass, including
stackviewson/off and O0/O2 recompilation. ELF64 cases each compare 4,096 native/recompiled calls per optimization. The three ELF cases fail before the fix.make check-specpasses; full suites are left to CI.