https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116988
Bug ID: 116988 Summary: Documentation for local register variables with inline-asm could have better example Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: documentation Severity: enhancement Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Noticed while reading/helping https://hachyderm.io/@pkhuong@discuss.systems/113255889240859000 . A few things here. First off: "Some developers use Local Register Variables in an attempt to improve gcc’s allocation of registers, especially in large functions. ..." this should be improved to just say: "Some developers will try to use Register Variables in an attempt to improve gcc’s allocation of registers, the problems listed with respect to inline-asm and calls will cause issues and should not be used". Second is the example with the inline-asm only has about inputs having issue but outputs have the same issue too: so we have: ``` int *t1 = …; register int *p1 asm ("r0") = …; register int *p2 asm ("r1") = t1; register int *result asm ("r0"); asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2)); ``` It should be : ``` int *t1 = …; register int *p1 asm ("r0") = …; register int *p2 asm ("r1") = t1; register int *r0 asm ("r0"); asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2)); int result = r0; .... ```