ci: fix vtcc sed patch — use int(-2147483648) not u32 for shf_private#26869
Open
quaesitor-scientiam wants to merge 1 commit intovlang:masterfrom
Open
ci: fix vtcc sed patch — use int(-2147483648) not u32 for shf_private#26869quaesitor-scientiam wants to merge 1 commit intovlang:masterfrom
quaesitor-scientiam wants to merge 1 commit intovlang:masterfrom
Conversation
The previous patch (in vlang#26858) changed `int(0x8000_0000)` → `u32(0x8000_0000)`, which fixed the overflow warning but introduced a new type error: failed src/tccelf.v:49:65: error: `(shf_private | shf_dynsym)` (no value) used as value in argument 4 to `new_symtab` Root cause: `shf_dynsym` is still `int` and `new_symtab` takes `sh_flags int`; V cannot OR `u32 | int` and implicitly pass the result as `int`. Changing to `u32` throughout cascades into 20+ sites across tccelf.v and struct Section. Correct workaround: use `-2147483648` (INT_MIN) instead — the identical bit pattern as `0x8000_0000` in two's complement, with type `int`. No downstream type changes needed. A proper fix has been filed upstream at felipensp/vtcc#7. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Once vtcc#7 merges, the right follow-up is a third PR to remove the sed patch entirely from compile_v_with_vtcc.sh (since the fix will be in the source). @felipensp |
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.
Follow-up to #26858
The vtcc workaround in #26858 patched
const shf_private = int(0x8000_0000)→u32(0x8000_0000). This fixed the overflow warning but introduced a new error visible in thec80a8a8CI run:Root cause:
shf_dynsymis stillintandnew_symtabtakessh_flags int. V cannot ORu32 | intand pass the result asint. Fixing by cascadingu32throughstruct Section.sh_flags,new_section, andnew_symtabwould touch 20+ bitwise-op sites.Fix: use
-2147483648(INT_MIN) — the same bit pattern as0x8000_0000in two's complement signed arithmetic. Type staysint, no cascading changes needed.A proper upstream fix has been filed at felipensp/vtcc#7. This sed patch is a temporary workaround until that merges into the stable branch.
Test plan
Test vtccpasses on ubuntu-latest without overflow warning or type error🤖 Generated with Claude Code