Repository navigation
Conversation
Null(), Null(null) and the constructors from a null Dynamic or Variant left value unset. Default() reads it only when isNull is false, but GCC at -O2 can compute `isNull ? true : value` as `isNull | value`: an omitted Bool argument with a default of true then came out as the bytes the caller's frame held (23, 25, 103), and `compress ? 8 : 0` gave 184. Stock hxcpp 4.3.2 compiles the same code. value is now value-initialized. Test: regression/NullDefaultArgument builds each kind of Null over bytes that are not a bool and checks the value is cleared (each was 254). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tutez64
added a commit
to Tutez64/Dungeon-Rampage-Haxe
that referenced
this pull request
Dec 3, 2026
- air-compat 0.1.0, its first haxelib release: Digest, Encryption, ZipArchive and ZipEntry beside the WebSocket, which is unchanged. - libhxcpp: upstream's main with the fix for a Bool argument with a default of true that, left out, could arrive as stack bytes (openfl/libhxcpp#513, open). The game builds, connects over wss, the test mods give the same last-run.json and the launcher's 24 mods load compiled. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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 Bool argument with a default that a call leaves out comes as an
hx::Null<bool>built fromnull,whose constructor set
isNulland leftvalueunset.Default()only returnsvaluewhenisNullis false, but GCC at -O2 may computeisNull ? true : valuewithout a branch, asisNull | value: then the bytes the caller's frame held come into the result. In an OpenFL build,new ZipEntry(name), whose constructor takescompress:Bool = true, stored 23, 25 or 103 incompress, andcompress ? 8 : 0, compiled ascompress << 3, wrote 184 as the zip method:Stock hxcpp 4.3.2 compiles the same code from the same generated source, so this is not new.
Null(),Null(null), and the constructors from a nullDynamicorcpp::Variantnow value-initialize
value: 0, false, or an empty value for the class typesNullis used with.Built against this branch, the same generated source stores 1 each time, where main's runtime
stored 23, 25, 27, 43, 45, 61 over three rounds.
Test:
test/regression/NullDefaultArgumentbuilds each kind ofNullover bytes that are not abool and checks the value is cleared; before the change, each one was left as 0xFE (254). The
regression tests on default arguments and boxed Bools still pass (DefaultFuncForeignThis,
CppiaDefaultArgFrames, CppiaBoolBoxing, CffiNekoNullBoolWithoutInit).