An error-first tagged union -- error variant at tag 0, success at tag 1+, e.g. (myerr | u16) -- was silently miscompiled by wwstage: the try/propagate codegen hardcoded success = tag 0, so the actual success value (tag 1) failed the CMPQ $0 and fell to the error path -> exit(1) instead of the value (44). cstage was correct (computes the success tag via cg_tagged_success_tag = first non-error variant). wwstage-only: a successtag/successvariant helper (mirroring cstage) replaces the hardcoded tag-0 / first-param assumption at all four try sites -- cgtryprop (?), cgtryunw (!), and the two latent shift sites cgtrytupleshift + cgtrytaggedshift (which bite an error-first union with an aggregate success payload). Success-first unions (the Hare idiom + what the selfhost uses) keep successtag=0 -> CMPQ $0 unchanged -> byte-id-neutral on 990-997. cstage untouched (w6c md5 unchanged). byte-id 990-997 8/8. test/wcc/825 table-driven (errfirst must/prop + tuple-success + success-first control). A separate nested-tagged-union construction divergence is filed (#10/#125).
8.5 KiB
8.5 KiB