------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-06
19:40 -------
It also fails with last nights build of gcc of the mainline.
And 3.4.0, 3.3.3, 3.2.3 and 3.0.4.
Here is a testcase which also fails too (this is what fold does):
void abort ();
void f1(unsigned short ad)
{
if ((short int) (ad - 16384) >= 0)
abort ();
}
int main (void)
{
f1(0xff00);
return 0;
}
The RTL is wrong right away:
(insn 13 11 14 (set (reg:HI 60)
(subreg/u:HI (reg/v:SI 58 [ ad ]) 0)) -1 (nil)
(nil))
(insn 14 13 15 (parallel [
(set (reg:SI 61)
(plus:SI (subreg:SI (reg:HI 60) 0)
(const_int -16384 [0xffffc000])))
(clobber (reg:CC 17 flags))
]) -1 (nil)
(nil))
(insn 15 14 16 (set (reg:CCGOC 17 flags)
(compare:CCGOC (subreg:HI (reg:SI 61) 0)
(const_int 0 [0x0]))) -1 (nil)
(nil))
(jump_insn 16 15 0 (set (pc)
(if_then_else (lt (reg:CCGOC 17 flags)
(const_int 0 [0x0]))
(label_ref 0)
(pc))) -1 (nil)
(expr_list:REG_BR_PROB (const_int 9900 [0x26ac])
(nil)))
on PPC we get:
(insn 11 9 12 (set (reg:HI 119)
(subreg/u:HI (reg/v:SI 118 [ ad ]) 2)) -1 (nil)
(nil))
(insn 12 11 13 (set (reg:SI 120)
(plus:SI (subreg:SI (reg:HI 119) 0)
(const_int -16384 [0xffffffffffffc000]))) -1 (nil)
(nil))
(insn 13 12 14 (set (reg:SI 121)
(sign_extend:SI (subreg:HI (reg:SI 120) 2))) -1 (nil)
(nil))
(insn 14 13 15 (set (reg:CC 122)
(compare:CC (reg:SI 121)
(const_int 0 [0x0]))) -1 (nil)
(nil))
(jump_insn 15 14 0 (set (pc)
(if_then_else (lt (reg:CC 122)
(const_int 0 [0x0]))
(label_ref 0)
(pc))) -1 (nil)
(expr_list:REG_BR_PROB (const_int 9900 [0x26ac])
(nil)))
Notice the sign_extend in the PPC but not in the x86 case.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|rtl-optimization |middle-end
Ever Confirmed| |1
GCC build triplet|i386-linux |
GCC host triplet|i386-linux |
Known to fail| |3.4.0 4.0.0 3.0.4 3.2.3
| |3.3.3
Known to work| |2.95.3
Last reconfirmed|0000-00-00 00:00:00 |2005-01-06 19:40:30
date| |
Summary|[3.3 regression] Range check|[3.3/3.4/4.0 regression]
|on short miscompiled at -O |Range check on short
| |miscompiled at -O
Target Milestone|--- |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19296