[Bug middle-end/104763] [12.0] Generate wrong assembly code
570070308 at qq dot com
gcc-bugzilla@gcc.gnu.org
Thu Mar 3 05:08:24 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104763
--- Comment #3 from 。 <570070308 at qq dot com> ---
(In reply to Jakub Jelinek from comment #2)
> Can't reproduce with -O2, with -O1 there are 2 stores instead of 3
> before the endless loop starting with
> r9-384-gf1bcb061d172ca7e3bdcc46476b20776382a2974
edit `+2` to `+7` then -O3 will be wrong too.
test.c:
```
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
void move_up()
{
for ( size_t* i=(size_t *)(0xb8000+160*24); ; )
{
*i=0x0700070007000700;
if ( i == (size_t *)(0xb8000+160*24)+7 )
{
break;
}
++i;
}
while (1){}
}
```
assembly with -O3:
```
move_up:
.LFB0:
.cfi_startproc
endbr64
movabsq $504410854964332288, %rax
movq %rax, 757512
movq %rax, 757520
movq %rax, 757528
movq %rax, 757536
movq %rax, 757544
movq %rax, 757552
movq %rax, 757560
.L2:
jmp .L2
.cfi_endproc
```
More information about the Gcc-bugs
mailing list