https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95431
--- Comment #2 from Andrew Pinski ---
Looks correct at the gimple level:
[t.c:6:3] # DEBUG BEGIN_STMT
[t.c:6:16] one.0_1 ={v} one;
[t.c:6:16] _2 = (char) one.0_1;
[t.c:6:8] a1[0] = _2;
[t.c:6:8] MEM [(char *)&a1 + 1B] = 770;
[t.c:6:8] a1[3] = 4;
[t.c:7:3] # DEBUG BEGIN_STMT
[t.c:7:8] a2[0] = 1;
[t.c:7:19] one.1_3 ={v} one;
[t.c:7:19] _4 = (unsigned char) one.1_3;
[t.c:7:19] _5 = _4 * 2;
[t.c:7:19] _6 = (char) _5;
[t.c:7:8] a2[1] = _6;
[t.c:7:8] MEM [(char *)&a2 + 2B] = 1027;
[t.c:8:3] # DEBUG BEGIN_STMT
[t.c:8:31] one.2_7 ={v} one;
[t.c:8:31] _8 = one.2_7 + 5;
[t.c:8:13] _9 = (long unsigned int) _8;
[t.c:8:13] res_19 = memcmp ([t.c:8:21] &a1, [t.c:8:25] &a2, _9);
[t.c:8:13] # DEBUG res => res_19
[t.c:9:3] # DEBUG BEGIN_STMT
Assembly:
.loc 1 6 3 view .LVU1
.loc 1 5 12 is_stmt 0 view .LVU2
subq$24, %rsp
.cfi_def_cfa_offset 32
.loc 1 6 16 view .LVU3
movlone(%rip), %eax
.loc 1 7 8 view .LVU4
movl$1027, %edx
movw%dx, 14(%rsp)
.loc 1 8 13 view .LVU5
leaq12(%rsp), %rsi
leaq8(%rsp), %rdi
.loc 1 6 16 view .LVU6
movb%al, 8(%rsp)
.loc 1 6 8 view .LVU7
movl$770, %eax
movw%ax, 9(%rsp)
.loc 1 7 19 view .LVU8
movlone(%rip), %eax
.loc 1 8 31 view .LVU9
movlone(%rip), %edx
.loc 1 6 8 view .LVU10
movb$4, 11(%rsp)
.loc 1 7 3 is_stmt 1 view .LVU11
.loc 1 8 3 view .LVU12
.loc 1 7 19 is_stmt 0 view .LVU13
addl%eax, %eax
.loc 1 7 8 view .LVU14
movb$1, 12(%rsp)
.loc 1 8 31 view .LVU15
addl$5, %edx
.loc 1 7 19 view .LVU16
movb%al, 13(%rsp)
.loc 1 8 13 view .LVU17
movslq %edx, %rdx
This could be a gdb issue because what GCC produces look correct.