fix 32 bit int simple return of riscv64 bridge
authorSakura286 <sakura286@outlook.com>
Mon, 24 Jul 2023 08:47:16 +0000 (16:47 +0800)
committerRene Engelhard <rene@debian.org>
Thu, 30 Nov 2023 18:47:03 +0000 (19:47 +0100)
commitf0fa403d8f854c26925f023f344e156f84b12712
tree57f44f543f1545fb4b881a7e826ebaac9a073689
parent3247e7190e2b1f7a3a505e86c90bf1d0c4c76361
fix 32 bit int simple return of riscv64 bridge

Sometimes we need to return a 32 bit integer into a 64 bit integer.
For example, in pyuno.cxx:PyUNO_bool(), an int(32bit) is returned in
type Py_ssize_t(64bit). We assume that this 32bit int was put in low
32 bit of register a0. The bridge may return with high 32 bit
uncleaned and compiler might directly bind this register to 64 bit
variable in error.

This bug produces when build pyuno with gcc-12 with -O2.
https://bugs.documentfoundation.org/show_bug.cgi?id=155937
https://lists.debian.org/debian-riscv/2023/07/msg00011.html

So we need to clean the high 32 bit in bridge.

Change-Id: I37aafb03ba9523cfb90912871308921fbeaf5f0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154837
Tested-by: René Engelhard <rene@debian.org>
Reviewed-by: René Engelhard <rene@debian.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Gbp-Pq: Name fix-riscv64-bridges.diff
bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx