sheaf pushed to branch wip/T23210 at Glasgow Haskell Compiler / GHC Commits: 78bb735d by Ben Gamari at 2025-09-16T12:56:15+02:00 StgToByteCode: Don't assume that data con workers are nullary Previously StgToByteCode assumed that all data-con workers were of a nullary representation. This is not a valid assumption, as seen in #23210, where an unsaturated application of a unary data constructor's worker resulted in invalid bytecode. Sadly, I have not yet been able to reduce a minimal testcase for this. Fixes #23210. - - - - - 521b9264 by Ben Gamari at 2025-09-16T12:56:15+02:00 testsuite: Mark T23146* as unbroken - - - - - 3 changed files: - compiler/GHC/StgToByteCode.hs - rts/Interpreter.c - testsuite/tests/codeGen/should_run/T23146/all.T Changes: ===================================== compiler/GHC/StgToByteCode.hs ===================================== @@ -2331,11 +2331,12 @@ pushAtom d p (StgVarArg var) -- PUSH_G doesn't tag constructors. So we use PACK here -- if we are dealing with nullary constructor. case isDataConWorkId_maybe var of - Just con -> do - massert (isNullaryRepDataCon con) - return (unitOL (PACK con 0), szb) + Just con + -- See Note [LFInfo of DataCon workers and wrappers] in GHC.Types.Id.Make. + | isNullaryRepDataCon con -> + return (unitOL (PACK con 0), szb) - Nothing + _ -> -- see Note [Generating code for top-level string literal bindings] | idType var `eqType` addrPrimTy -> return (unitOL (PUSH_ADDR (getName var)), szb) ===================================== rts/Interpreter.c ===================================== @@ -2227,7 +2227,6 @@ run_BCO: // n_nptrs=1, n_ptrs=0. ASSERT(n_ptrs + n_nptrs == n_words || (n_nptrs == 1 && n_ptrs == 0)); ASSERT(n_ptrs + n_nptrs > 0); - //ASSERT(n_words > 0); // We shouldn't ever need to allocate nullary constructors for (W_ i = 0; i < n_words; i++) { con->payload[i] = (StgClosure*)ReadSpW(i); } ===================================== testsuite/tests/codeGen/should_run/T23146/all.T ===================================== @@ -1,4 +1,4 @@ test('T23146', normal, compile_and_run, ['']) test('T23146_lifted', normal, compile_and_run, ['']) -test('T23146_liftedeq', expect_broken_for(23060, ghci_ways), compile_and_run, ['']) +test('T23146_liftedeq', normal, compile_and_run, ['']) test('T23146_lifted_unlifted', normal, compile_and_run, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/85c987066933b4b5fe7992a2ee0e2bc... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/85c987066933b4b5fe7992a2ee0e2bc... You're receiving this email because of your account on gitlab.haskell.org.