[Bug c/88160] New: Error: register save offset not a multiple of 4
armin at diedering dot de
gcc-bugzilla@gcc.gnu.org
Thu Nov 22 22:03:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88160
Bug ID: 88160
Summary: Error: register save offset not a multiple of 4
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: armin at diedering dot de
Target Milestone: ---
The bug can reproduced in gcc-4.9.4 and gcc-8.1.0 for target m68k.
The error may also affect other targets. It's IMHO internal stuff.
More accurate: The bug treated by compilation for a coldfire cpu (mcpu=5475)
and 16 bit integers (-mshort) with Dwarf2 debug enabled (-g) and optimize (-O2)
test.c:
--------------------------------------------------
void *memset(void*,int,size_t);
void test(void *p) {
memset(p,0,166);
asm("":::"d4","d5","d6"); // force sve regs to sp
}
--------------------------------------------------
gcc -mcpu=5475 -g -S test.c -o-
outputs:
--------------------------------------------------
.cfi_startproc
lea (-12,%sp),%sp <-- allocate freame
.cfi_def_cfa_offset 16
movem.l #112,(%sp) <-- save regs d4-d6
.cfi_offset 4, -16
.cfi_offset 5, -12
.cfi_offset 6, -8
.loc 1 1 81
subq.l #2,%sp <-- extra space - coldfire defaults
.cfi_def_cfa_offset 18 PREFERRED_STACK_BOUNDARY to 32
pea 166.w
.cfi_def_cfa_offset 22
clr.w -(%sp)
.cfi_def_cfa_offset 24
move.l 24(%sp),-(%sp)
.cfi_def_cfa_offset 28
jsr _memset
--------------------------------------------------
thats o.k. no error
BUT with optimize (gcc 4.9.4 -O2 and above and gcc 8.1.0 -O0 and above
gcc -mcpu=5475 -g -O2 -S test.c -o-
outputs:
--------------------------------------------------
.cfi_startproc
.loc 1 1 79 is_stmt 0 view .LVU1
lea (-14,%sp),%sp <-- extra space from above now merged
.cfi_def_cfa_offset 20 <-- BUG BUG BUG should be 18
movem.l #112,2(%sp) <-- 2(%sp) 2==space from above o.k.
.cfi_offset 4, -18 <- should -16 [ -cfi_def_cfa_offset+2 ]
.cfi_offset 5, -14 <- should -12 [ -cfi_def_cfa_offset+2+4 ]
.cfi_offset 6, -10 <- should -8 [ -cfi_def_cfa_offset+2+8 ]
.loc 1 1 81 is_stmt 1 view .LVU2
pea 166.w
.cfi_def_cfa_offset 24
clr.w -(%sp)
.cfi_def_cfa_offset 26
move.l 24(%sp),-(%sp)
.cfi_def_cfa_offset 30
jsr _memset
--------------------------------------------------
More information about the Gcc-bugs
mailing list