https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81803
Chen Qi <qi.chen at windriver dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |qi.chen at windriver dot com --- Comment #11 from Chen Qi <qi.chen at windriver dot com> --- mpf, I'm working on Yocto project. I also encountered a similar problem. In brief, on qemumips64, `systemctl status <xxx>' has the output of `systemctl show <xxx>'. I debugged a little bit and found that it's not the code logic's problem. Instead it's gcc optimization problem. With '-O1', the problem is reproduced; with '-O0', the problem is gone. Please see https://bugzilla.yoctoproject.org/show_bug.cgi?id=12266 for more details. I used the patch you created in attachment. And things work correctly with '-O2'. Is there any plan sending the patch to gcc mailing list? Is there any known problem about the patch? Best Regards, Chen Qi (In reply to mpf from comment #9) > Created attachment 42075 [details] > Proposed fix > > Off-thread James pointed out that one of my patches I did last year appeared > to fix this issue but it was one I reverted owing to breaking ARM (and > probably others). The thread was: > > https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00518.html > > At the time I thought I had fixed the same problem twice and that the > changes to simplify_operand_subreg were sufficient. It occurs to me however > that simplify_operand_subreg only has the opportunity to fix > WORD_REGISTER_OPERATIONS issues affecting subreg(mem) patterns not > subreg(reg) patterns where reg is a pseudo that may yet be spilled. > > I can't say that I am 100% convinced yet with my thinking here but I've > attached an updated version of the original patch with some changes: > > * Incorporated Eric's feedback on the original patch to check > GET_MODE_PRECISION instead of GET_MODE_SIZE for comparing whether a mode is > strictly narrower > * Limited the test to word sized inner modes or smaller > * Limited the test to OP_OUT or OP_INOUT as I can't see any reason why it > would matter if we do a narrower input reload > > This is barely tested but does fix testcase-c which is the only one I can > get to trigger.