public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla@gcc.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 20:54:00 -0000 [thread overview] Message-ID: <bug-65321-4-CEusfVhLgM@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-65321-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65321 --- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- (In reply to Richard Biener from comment #3) > (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 take your point, but at the same time, is it really worth supporting shifts whose shift amount is wider than the shifted value? ISTM that no .md pattern would want such a thing, so in practice this would only ever happen with debug exprs. I think the safest fix would be to make use_narrower_mode{,_test} narrow the shift amount if it is wider than the target mode. Just tried that locally and it seems to fix the test case. > 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. Certainly SImode would be dangerous, since there's nothing to stop the same bug reappearing with DImode. MAX_MODE_INT is a problem because it can be wider than MAX_BITSIZE_MODE_ANY_INT on targets like x86_64 that explicitly override the wide_int size. And I'd be reluctant to relax the general CONST_INT semantics for such an oddball case. Thanks, Richard
next prev parent reply other threads:[~2015-03-05 20:54 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-05 5:59 [Bug target/65321] New: " su at cs dot ucdavis.edu 2015-03-05 8:49 ` [Bug target/65321] " mpolacek at gcc dot gnu.org 2015-03-05 8:51 ` [Bug debug/65321] " mpolacek at gcc dot gnu.org 2015-03-05 9:17 ` [Bug rtl-optimization/65321] [5 Regression] " rguenth at gcc dot gnu.org 2015-03-05 11:07 ` rguenth at gcc dot gnu.org 2015-03-05 20:54 ` rsandifo at gcc dot gnu.org [this message] 2015-03-06 8:41 ` rguenther at suse dot de 2015-03-07 10:32 ` rsandifo at gcc dot gnu.org 2015-03-07 15:09 ` law at redhat dot com 2015-03-09 8:20 ` jakub at gcc dot gnu.org 2015-03-09 10:18 ` rguenth at gcc dot gnu.org 2015-03-09 12:05 ` rsandifo at gcc dot gnu.org 2015-03-10 6:37 ` jakub at gcc dot gnu.org 2015-03-10 6:43 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-65321-4-CEusfVhLgM@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).