[Bug middle-end/70593] [6 Regression] Miscompilation of xen starting with r226901
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 8 08:47:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70593
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Simplified testcase:
__attribute__((noinline, noclone)) unsigned long
foo (unsigned x)
{
unsigned long a, c = x;
asm volatile ("xorl\t%k1, %k1\n\tmovl\t$7, %k0"
: "=c" (c), "=a" (a) : "0" (c), "1" (c) : "memory");
return c;
}
int
main ()
{
if (foo (3) != 7)
__builtin_abort ();
return 0;
}
The *.optimized dump looks good:
c_2 = (long unsigned int) x_1(D);
__asm__ __volatile__("xorl %k1, %k1
movl $7, %k0" : "=c" c_5, "=a" a_6 : "0" c_2, "1" c_2 : "memory");
return c_5;
but in *.expand we have incorrect:
(note 1 0 4 NOTE_INSN_DELETED)
(note 4 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn 2 4 3 2 (set (reg/v:SI 88 [ x ])
(reg:SI 5 di [ x ])) pr70593.c:3 -1
(nil))
(note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)
(insn 6 3 9 2 (set (reg/v:DI 87 [ <retval> ])
(zero_extend:DI (reg/v:SI 88 [ x ]))) pr70593.c:4 -1
(nil))
(insn 9 6 7 2 (parallel [
(set (reg:DI 89 [ c ])
(asm_operands/v:DI ("xorl %k1, %k1
movl $7, %k0") ("=c") 0 [
(reg/v:DI 87 [ <retval> ])
(reg/v:DI 87 [ <retval> ])
]
[
(asm_input:DI ("0") pr70593.c:5)
(asm_input:DI ("1") pr70593.c:5)
]
[] pr70593.c:5))
(set (reg:DI 90 [ a ])
(asm_operands/v:DI ("xorl %k1, %k1
movl $7, %k0") ("=a") 1 [
(reg/v:DI 87 [ <retval> ])
(reg/v:DI 87 [ <retval> ])
]
[
(asm_input:DI ("0") pr70593.c:5)
(asm_input:DI ("1") pr70593.c:5)
]
[] pr70593.c:5))
(clobber (mem:BLK (scratch) [0 A8]))
(clobber (reg:CCFP 18 fpsr))
(clobber (reg:CC 17 flags))
]) pr70593.c:5 -1
(nil))
(insn 7 9 8 2 (set (reg/v:DI 87 [ <retval> ])
(reg:DI 89 [ c ])) pr70593.c:5 -1
(nil))
(insn 8 7 13 2 (set (reg/v:DI 87 [ <retval> ])
(reg:DI 90 [ a ])) pr70593.c:5 -1
(nil))
(insn 13 8 14 2 (set (reg/i:DI 0 ax)
(reg/v:DI 87 [ <retval> ])) pr70593.c:7 -1
(nil))
(insn 14 13 0 2 (use (reg/i:DI 0 ax)) pr70593.c:7 -1
(nil))
insn 8 really shouldn't be there.
More information about the Gcc-bugs
mailing list