Repository navigation
[AUTOMATED] Preserve word bits through resolved union members - #1244
Merged
Merged
Conversation
thotypous
marked this pull request as draft
October 21, 2026 14:59
Contributor
Author
|
[AUTOMATED] Fixed the parity failure in 5a10955. Named frame-member type lookup now respects The existing |
thotypous
marked this pull request as ready for review
October 21, 2026 16:45
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEr111CDLJsQMzY3YSyWXD
…nsfer section The CAST/COPY printed-type rule and the stackviews gate for named frame members now sit with the Noelo-Lab#1230 named-member rule they extend, instead of a detached paragraph at the end of the chapter. 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 two commits so this merges with current main:
Behavior is unchanged from 5a10955. |
Noelo-Lab#1231 removed the COPY member gate in storage_transfer, so every same-width COPY is judged by its printed types; that subsumes this branch's printed-type gate. Kept: printed member types for CAST as well as COPY, and the stackviews gate for named frame members. 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
mahaloz
added a commit
to thotypous/kuna
that referenced
this pull request
Oct 22, 2026
Noelo-Lab#1244 landed as a squash; this re-applies only Noelo-Lab#1247'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
mahaloz
pushed a commit
that referenced
this pull request
Oct 22, 2026
A byte-copy helper can turn an unaligned word copy into a numeric float conversion. A native input word of `1` then comes back as `1065353216` (`1.0f` bits).
```sh
cat > copy.c <<'C'
union block { float real[32]; unsigned integer[32]; } items;
__attribute__((naked)) unsigned transfer(unsigned index) {
__asm__("movl 4(%esp),%eax; shll $2,%eax; movl _items+1(%eax),%edx;"
"movl %edx,_items+64; flds _items+64; fstps _items+68;"
"movl _items+64,%eax; retl");
}
C
clang --target=i686-w64-windows-gnu -O1 -c copy.c -o copy.obj
kuna decompile-project copy.obj -o output --option nanignore none \
--option indexaliasguard full --option stackviews on \
--assert 'typedef union block {float real[32];unsigned int integer[32];} block;' \
--assert 'data 0x400028 block items' \
--assert 'prototype _transfer unsigned int __cdecl transfer(unsigned int index)'
cat output/copy.obj.c
```
Before: `items.real[0x10] = *(unsigned int *)__builtin_memcpy(&(unsigned int){0}, ...);`
- A statement LOAD copies into a compound literal with the rendered destination member’s same-width scalar type.
- A STORE uses the rendered source member’s type for its compound initializer. Both paths preserve bytes instead of converting integer and float values.
- Builds on #1244’s operation-facing member lookup.
Tests cover PE32 and ELF64, union and float-only declarations, strict Clang recompilation at `-O0`/`-O2`, and native ELF return values plus all 128 backing bytes across 4,096 finite patterns per configuration.
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.
An indexed word copy can become a numeric float conversion. A native input word of
1then comes back as1065353216(1.0fbits).Before:
items.real[0x10] = (unsigned int)items.integer[index];Tests cover PE32 and ELF64, strict Clang recompilation, and 4,096 native/regenerated ELF calls at each of
-O0and-O2.