From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30756 invoked by alias); 5 Mar 2015 11:07:50 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 30709 invoked by uid 48); 5 Mar 2015 11:07:46 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/65321] [5 Regression] ICE on valid code at -O2 and -O3 with -g enabled in decompose, at rtl.h:2007 Date: Thu, 05 Mar 2015 11:07:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg00596.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65321 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rsandifo at gcc dot gnu.org --- Comment #3 from Richard Biener --- (gdb) p debug_rtx (x.first) (const_int 128 [0x80]) (gdb) p x.second $2 = QImode (gdb) p precision $3 = 8 the CONST_INT is not properly sign-extended. This is from #6 0x0000000000d55381 in simplify_const_binary_operation (code=ASHIFT, mode=QImode, op0=0x7ffff68d3490, op1=0x7ffff69e8b00) at /space/rguenther/src/svn/trunk2/gcc/simplify-rtx.c:4001 ... 3997 case LSHIFTRT: 3998 case ASHIFTRT: 3999 case ASHIFT: 4000 { 4001 wide_int wop1 = pop1; 4002 if (SHIFT_COUNT_TRUNCATED) 4003 wop1 = wi::umod_trunc (wop1, width); but of course the shift amount need not be QImode as well. 128 is quite large, but well... Fact is that we don't know the mode of op1 here. From the fact that the const_int is not sign-extended we can conclude its mode is larger than QImode. And we will truncate it anyway (or return NULL_RTX) if it is too large, so it doesn't even matter. I think we can simply use wide_int wop1 = std::make_pair (op1, MAX_MODE_INT); here (or SImode maybe). Or have a "don't care" way to make a wide-int from a CONST_INT directly. Richard?