Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

RISC-V NCG: Floating-point variables may be clobbered in a function call
## Summary The RISC-V NCG wrongly assigns temporary registers to floating-point variables that live across a function call. According to [the RISC-V calling convention](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#floating-point-register-convention), the floating-point registers `f28-f31` (`ft8-ft11`) are temporary, but `callerSavedRegisters` in [compiler/GHC/CmmToAsm/RV64/Instr.hs](https://gitlab.haskell.org/ghc/ghc/-/blob/6779bb0c2d2784182465337ba5e94b7cd8810f2b/compiler/GHC/CmmToAsm/RV64/Instr.hs#L157-L167) don't contain them. As a result, local variables may contain garbage values after a function call. ## Steps to reproduce Run `FloatFnInverses` with the `optasm` way: ``` $ hadrian/build -j4 --flavour=quick test --only=FloatFnInverses --test-way=optasm --test-way=normal --test-way=llvm --test-way=optllvm ... Actual stdout output differs from expected: --- "/tmp/ghctest-ib0v7y8y/test spaces/testsuite/tests/numeric/should_run/FloatFnInverses.run/FloatFnInverses.stdout.normalised" 2026-05-27 13:28:07.044031349 +0900 +++ "/tmp/ghctest-ib0v7y8y/test spaces/testsuite/tests/numeric/should_run/FloatFnInverses.run/FloatFnInverses.run.stdout.normalised" 2026-05-27 13:28:07.044162806 +0900 @@ -10,7 +10,7 @@ [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] -[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[0.0,14.1633356824168,29.0,44.459241625343566,60.272338776121615,74.76540270890109,90.90850816418242,105.07156379247317,121.46178820960631,135.28542215838388,152.07723526199698,165.57107152690878,182.6926823144022,195.72357510037546,213.163060826133,225.9887405004265,243.75778380129486,256.2539059004921,274.16624242265243,286.32446040882496,304.7402693585027,316.5691404518584,335.31429629435297,346.5785575861519,365.63995042667375,376.8027799849515,396.19327962890384,406.75080604742107,426.4572326244379,436.95456945833575,456.989892097612,467.158332869265,487.1918095483852,497.0249796825374,517.7037976451538,527.2083117845177,548.2157857419224,557.0136406392412,578.3355491388356,587.1765401332668,608.8268938303518,617.3394396272779,638.8853132140648,647.0636324175721,669.3560424147436,677.2061269486294,699.8267716154078,706.86907536535] [0.0,0.0,0.0,0.0,0.0,0.0] -[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] -[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] +[-9.99999999476131e-3,-0.1300000000046566,-0.25,-0.3699999999953434,-0.4900000000052387,-0.6100000000005821,-0.7299999999959255,-3.54505729363882,-1.5090114587219432,0.5270343761803815,2.563080211097258,-1.3300000000017462,-1.4499999999970896,-1.570000000006985,-1.6900000000023283,-1.8099999999976717,-1.929999999993015] +[7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33,7.788445287802241e33] *** unexpected failure for FloatFnInverses(optasm) ... ``` The LLVM ways produce the correct output, so this is a problem in the NCG, not one in the mathematical routines (`cosh`, `tanh`, or `tanhf`). Looking at the assembly code, `ft8` is used across the call to `cosh`. ## Expected behavior The output of `FloatFnInverses` should be zeros. ## Environment * GHC version used: 10.1.20260525 (cccf45da) * Operating System: Bianbu 4.0 (an Ubuntu 26.04-based Linux distro) * System Architecture: 64-bit RISC-V
issue