[Bug target/107841] Incorrect generation of the function's epilogue code when there is a _builtin_alloca call.
avo2000 at mail dot ru
gcc-bugzilla@gcc.gnu.org
Thu Nov 24 10:34:05 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107841
--- Comment #2 from Alexander <avo2000 at mail dot ru> ---
Source code:
void qq(int a) {
char *s = alloca(128);
sprintf(s,"qq %d",3);
}
Generated code:
0000040c <_qq>:
40c: 1166 mov r5, -(sp)
40e: 1185 mov sp, r5
410: 65c6 ff80 add $-200, sp
414: 1180 mov sp, r0
416: 15e6 0003 mov $3, -(sp)
41a: 15e6 1868 mov $14150, -(sp)
41e: 1026 mov r0, -(sp)
420: 09f7 0326 jsr pc, 74a <_sprintf>
424: 65c6 0006 add $6, sp
428: 1585 mov (sp)+, r5
42a: 0087 rts pc
The command "mov r5,sp" should be at the address 424
More information about the Gcc-bugs
mailing list