This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

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


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


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