On Fri, 21 Jun 2024, Richard Sandiford wrote: > > This has passed verification in native `powerpc64le-linux-gnu' and > > `x86_64-linux-gnu' regstraps, as well as with the `alpha-linux-gnu' > > target. OK to apply and backport to the release branches? > > Huh! Nice detective work.
Thank you. It did help that `call_pal 158' or the lack of is so easy to spot in disassembly or compiler output. Inspired by Roger Sayle's observation that the use of $0 hard register pre-reload is uncommon I tried to come up with an RTL test case that I *might* be able to tweak enough, knowing the nature of the bug, to still trigger with trunk. For that I backported `print_rtx_function' to 4.1.2. The output it produced was sufficiently different though from the syntax now accepted for input it wasn't suitable at all. So I thought I could perhaps tweak it by hand using output from GCC 15 as a reference. But that did not work either, GCC 15 cannot accept its own output it would seem, complaining about integer suffixes across a couple of places: rwlock-test.i:112:100: error: invalid suffix "B" on integer constant 112 | 32)) [1 MEM[(struct _pthread_descr_struct * *)rwlock_8(D) + 32B]+0 S8 A64])) "rwlock-test.i":84:5 discrim 1) | ^~~ and most importantly, the asm statement: rwlock-test.i:53:62: error: expected character `)', found `:' rwlock-test.i:53:65: note: following context is `37)' where input is: (cinsn 18 (set (reg/v:DI $0 [ __self ]) (asm_operands:DI ("call_pal %1") ("=r") 0 [ (const_int 158) ] [ (asm_input:SI ("i") rwlock-test.i:37) ] [] rwlock-test.i:37)) "rwlock-test.i":37:58) and the complaint about the `asm_input' expression, and it's not clear to me what is expected here. So I have given up. I guess the RTL parser could be improved, or maybe output produced from `print_rtx_function' isn't right, I don't know. > The patch is OK for trunk, thanks. I agree that it's a regression > from 08a692679fb8. Since it's fixing such a hard-to-diagnose wrong > code bug, and since it seems very safe, I think it's worth backporting > to all active branches, after a grace period. Agreed as to the grace period. I have since additionally run the patch through `riscv64-linux-gnu' verification and John David Anglin was kind enough to do so with `hppa-unknown-linux-gnu'. I have pushed the change to trunk now, thank you for your review. Maciej