https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91635
--- Comment #2 from Zdenek Sojka <zsojka at seznam dot cz> --- (In reply to Jakub Jelinek from comment #1) > Can't reproduce. > I get: > foo: > not a4,a0 > lui a5,%hi(b) > slli a0,a0,17 > sh a4,%lo(b)(a5) > srli a0,a0,17 > ret > at -O2 which looks correct. Thank you for checking this. I can reproduce the failure with a "native" gcc-9.2.0-gentoo in a chroot. I get the same result as you with -mabi=ilp32 ; perhaps you were compiling for the 32bit target? Please try adding -mabi=lp64d -march=rv64gc to the command line.