https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112478
Michael T. Kloos <Michael at MichaelKloos dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID |--- --- Comment #5 from Michael T. Kloos <Michael at MichaelKloos dot com> --- I disagree. To quote you: "You're using an ASM to implement a call. That means your asm is responsible for dealing with all ABI issues, including saving/restoring registers around the call. Essentially GCC has no visibility into what your ASM does. It's just a text string that gets passed through to the assembler." Exactly. I did handle that. I specified all register clobbers in either the outputs or clobber list of the asm statement. The %ra register is specified in the clobber list. GCC is not honoring that clobber. That is a regression in GCCs behavior. Of course, it would be possible to write an asm statement that GCC could not work around, such as if you clobbered every register so it could not track the stack pointer. That is a known limitation, will throw an error, and is not what we are talking about. Playing around with these ABI "special" registers inside inline asm is certainly not unheard of. There are many posts on the internet where such tricks are discussed and GCC supports them. If you are familiar with the ABI and are designing architecture specific code, it can be a great optimization. This change is a regression. It breaks any code that relies on this feature. Even if we conceded that clobbering the link register is not supported in GCC asm clobber lists, which I don't, you still can't shift the blame to me because the package that broke is not my code. It broke libgcc, GCC's own internals. The sample code that I provided is just a minimal way to reproduce the bug, but it's based on these parts of your own source code: > include/longlong.h > libgcc/config/riscv/muldi3.S > libgcc/config/riscv/multi3.c On riscv64 (The symbols get redefined on 64 vs 32 bit): > multi3 calls __muluw3() > __muluw3 is defined as a macro inside "include/longlong.h" > __muluw3 becomes an asm call statement that calls __muldi3. Beyond that, I have not attempted to further experiment with listing other registers as asm clobbers and playing around with the edge cases of this bug. I don't know if the clobbers of anything else was broken. I picked up on the case of ra, specifically, because it broke libgcc. I know you don't want to take the time to work on this. But if you are going to dismiss someone out of hand, at least take the time to read and understand their concerns. I went over the libgcc breakage in my original post.