This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: Fix gcc.c-torture/compile/20000818-1.c on m68k.c
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: Patch: Fix gcc.c-torture/compile/20000818-1.c on m68k.c
- From: Kazu Hirata <kazu at hxi dot com>
- CC: rth at redhat dot com
- CC: zippel at linux-m68k dot org
Hi,
http://gcc.gnu.org/ml/gcc-cvs/2001-08/msg00683.html
With the above patch, gcc miscompiles 20000412-5.c. Cutting down to
the bare minimum, the following is miscompiled on h8300 port.
int
foo (void)
{
int array[2] = { 0, 1 };
return array[0];
}
Specifically, without the patch, the function returns constant 0,
which is correct. With the patch, it returns constant 1.
Without the patch, test.c.00.rtl has the array initialization looking
like
(insn 9 5 11 (set (reg/v:SI 16)
(const_int 0 [0x0])) -1 (nil)
(nil))
(insn 11 9 16 (set (subreg:HI (reg/v:SI 16) 2)
(const_int 1 [0x1])) -1 (nil)
(nil))
With the patch, test.c.00.rtl has the array initialization looking
like
(insn 9 5 10 (set (reg/v:SI 16)
(const_int 0 [0x0])) -1 (nil)
(nil))
(insn 10 9 15 (set (strict_low_part (subreg:HI (reg/v:SI 16) 2))
(const_int 1 [0x1])) -1 (nil)
(nil))
"strict_low_part" is the only meaningful difference. Other
differences were insn numbers and such.
I would appreciate if somebody could take a look at this. I will
analyze this a bit further as well. By the way, h8300 port has
"sizeof (int) == 2".
Kazu Hirata