https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55212
--- Comment #343 from Kazumoto Kojima <kkojima at gcc dot gnu.org> --- (In reply to Oleg Endo from comment #342) > (In reply to John Paul Adrian Glaubitz from comment #339) > > /home/glaubitz/webkit2gtk-sh4-new-new/webkit2gtk-2.46.0/build-soup3/ > > JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-36.cpp > > (...) > > {standard input}: Assembler messages: > > {standard input}:6139: Error: syntax error in @(disp,[Rn, gbr, pc]) > > {standard input}:6139: Error: invalid operands for opcode > > {standard input}:54249: Error: syntax error in @(disp,[Rn, gbr, pc]) > > {standard input}:54249: Error: invalid operands for opcode > > {standard input}:59575: Error: syntax error in @(disp,[Rn, gbr, pc]) > > {standard input}:59575: Error: invalid operands for opcode > > {standard input}:61031: Error: syntax error in @(disp,[Rn, gbr, pc]) > > {standard input}:61031: Error: invalid operands for opcode > > > > I was able to reproduce it sh-elf copmiler by compiling the attached .ii > file with the following options: > > sh-elf-gcc -c -m4 -ml -matomic-model=soft-gusa -Wextra -Wall -pipe > -fmax-errors=20 -Wno-odr -Wno-stringop-overread -Wno-stringop-overflow > -Wno-nonnull -Wno-array-bounds -Wno-expansion-to-defined -Wno-noexcept-type > -Wno-psabi -Wno-misleading-indentation -Wno-maybe-uninitialized -Wundef > -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align > -Wno-tautological-compare -fasynchronous-unwind-tables -fdebug-types-section > -g1 -O2 fstack-protector-strong -fPIE -Wformat -Werror=format-security > -fno-strict-aliasing -fno-exceptions -fno-rtti -fcoroutines > -ffunction-sections -fdata-sections -fPIC -fvisibility=hidden > -ffp-contract=off -std=c++23 -save-temps -dp test.ii > > > The problematic insn is: > flds fr1,fpul ! 1297 [c=4 l=2] movsi_ie/21 > mov.b @(5,fpul),r0 ! 517 [c=2 l=2] *movqi/8 <<<<<<<<<< > > > now that looks like quite some adventurous register usage. > > This should actually be rejected by the 'sh_legitimate_address_p' function. > I guess that a check is missing somewhere in the code that does the > transformation? Yes. The wrong instruction mov.b @(5,fpul),r0 ! 517 [c=2 l=2] *movqi/8 is generated with *movqi insn which is defined by (define_insn "*mov<mode>" [(set (match_operand:QIHI 0 "general_movdst_operand" "=r,r,r,Sid,^zr,Ssd,r, Sdd,z, r,l") (match_operand:QIHI 1 "general_movsrc_operand" "Q,r,i,^zr,Sid,r, Ssd,z, Sdd,l,r"))] "TARGET_SH1 && (arith_reg_operand (operands[0], <MODE>mode) || arith_reg_operand (operands[1], <MODE>mode))" and the 8-th alternative is an Sdd memory load. general_mov{dst,src}_operand predicates check the memory displacement expression. They only check the address register with REG_P, though.