optimization/9279: [3.2 regression] [Sparc] combine bug

Christian Ehrhardt ehrhardt@mathematik.uni-ulm.de
Fri Jan 24 12:49:00 GMT 2003


Hi,

here's an even simpler example:


int x = 0;
char c, * p = &c, a = -1;
int main ()
{
	if ((x?0:(unsigned char)((*p) = a)) == -1)
		return 0;
	return 1;
}

The exitcode of this program should always be 1 but it is zero if
compiled with -O2.

The problem is that these two insns

(insn 24 23 25 (set (reg:SI 117)
        (zero_extend:SI (reg:QI 116))) 126 {*zero_extendqisi2_insn} (nil)
    (expr_list:REG_DEAD (reg:QI 116)
        (nil)))

(insn 25 24 26 (set (reg:CC 100 %icc)
        (compare:CC (reg:SI 117)
            (const_int -1 [0xffffffffffffffff]))) 0 {*cmpsi_insn} (insn_list 24 (nil))
    (expr_list:REG_DEAD (reg:SI 117)
        (nil)))

are combined into one like this:

(note 24 23 25 NOTE_INSN_DELETED)

(insn 25 24 26 (set (reg:CC 100 %icc)
        (compare:CC (subreg:SI (reg:QI 116) 0)
            (const_int 255 [0xff]))) 0 {*cmpsi_insn} (nil)
    (expr_list:REG_DEAD (reg:QI 116)
        (nil)))

   regards  Christian



More information about the Gcc-bugs mailing list