This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: Fix gcc.c-torture/compile/20000818-1.c on m68k.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]