public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/61757] [4.10 Regression] genmodes failure with enable-checking Date: Mon, 14 Jul 2014 08:56:00 -0000 [thread overview] Message-ID: <bug-61757-4-fD7JUEkLPR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-61757-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61757 --- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> --- The first interesting difference is that for <bb 14>: _793 = ASSERT_EXPR <_73, _73 != 18>; switch (_793) <default: <L32>, case 0: <L26>, case 1: <L27>, case 2: <L28>, case 3: <L29>, case 4 ... 9: <L28>, case 10 ... 11: <L30>, case 12 ... 17: <L31>> <L28>: we record an equality instead of a range: @@ -17655,13 +17655,7 @@ BB #19 EDGE 14->19 14 [14.3%] (EXECUTABLE) - PREDICATE: _73 ge_expr 2 - - switch (_73) <default: <L32>, case 0: <L26>, case 1: <L27>, case 2: <L28>, case 3: <L29>, case 4 ... 9: <L28>, case 10 ... 11: <L30>, case 12 ... 17: <L31>> - - BB #19 - EDGE 14->19 14 [14.3%] (EXECUTABLE) - PREDICATE: _73 le_expr 9 + PREDICATE: _73 eq_expr 2 @@ -19815,9 +19806,8 @@ goto <bb 28>; <L28>: - _792 = ASSERT_EXPR <_794, _794 >= 2>; - _793 = ASSERT_EXPR <_792, _792 <= 9>; - _77 = _793 + 4294967288; + _792 = ASSERT_EXPR <_793, _793 == 2>; + _77 = _792 + 4294967288; _78 = _77 > 1; _79 = (requirement) _78; validate_mode (m_780, 2, 0, 1, 1, _79); that's of course bogus, happens via find_switch_asserts where for correctly sorted ci vector we fail to pick up CASE_HIGH of cast 4...9. We miscompile the loop /* Skip labels until the last of the group. */ do { ++idx; } while (idx < n && cbb == ci[idx].bb); to 0x0000000000b6a492 <+3074>: mov %eax,%r14d 0x0000000000b6a495 <+3077>: lea 0x1(%r14),%r15d => 0x0000000000b6a499 <+3081>: cmp %r15,%rcx 0x0000000000b6a49c <+3084>: mov %r15,%rax 0x0000000000b6a49f <+3087>: ja 0xb6a492 <find_assert_locations_1(basic_block, sbitmap)+3074> that is, we simply increment idx until it is equal to n and then use CASE_HIGH of the last case label in the vector which is the default label (and thus does not have CASE_HIGH nor CASE_LOW). The following testcase derived from that is miscompiled on trunk at -O2: extern void abort (void); struct X { void *p; int res; } a[32]; int foo (unsigned i, unsigned n, void *q) { if (i + 1 < n && q == a[i + 1].p) { do { ++i; } while (i < n && q == a[i].p); --i; return a[i].res; } } int main () { int x; a[0].p = &x; a[1].p = &x; a[1].res = 1; a[2].p = (void *)0; a[2].res = 0; if (foo (0, 3, &x) != 1) abort (); return 0; }
next prev parent reply other threads:[~2014-07-14 8:56 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-07-09 7:51 [Bug bootstrap/61757] New: " dcb314 at hotmail dot com 2014-07-09 8:56 ` [Bug bootstrap/61757] " dominiq at lps dot ens.fr 2014-07-09 10:14 ` ktkachov at gcc dot gnu.org 2014-07-09 11:56 ` [Bug bootstrap/61757] [4.10 Regression] " rguenth at gcc dot gnu.org 2014-07-09 12:45 ` [Bug tree-optimization/61757] " schwab@linux-m68k.org 2014-07-09 13:09 ` schwab@linux-m68k.org 2014-07-09 20:47 ` dominiq at lps dot ens.fr 2014-07-10 9:36 ` rguenth at gcc dot gnu.org 2014-07-10 9:39 ` ktkachov at gcc dot gnu.org 2014-07-10 10:29 ` schwab@linux-m68k.org 2014-07-10 14:43 ` rguenth at gcc dot gnu.org 2014-07-10 14:49 ` rguenth at gcc dot gnu.org 2014-07-11 13:29 ` rguenth at gcc dot gnu.org 2014-07-11 13:45 ` dominiq at lps dot ens.fr 2014-07-11 14:07 ` ro at gcc dot gnu.org 2014-07-11 14:26 ` schwab@linux-m68k.org 2014-07-11 16:16 ` pthaugen at gcc dot gnu.org 2014-07-11 17:24 ` matz at gcc dot gnu.org 2014-07-11 17:47 ` matz at gcc dot gnu.org 2014-07-11 18:32 ` schwab@linux-m68k.org 2014-07-11 23:03 ` pthaugen at gcc dot gnu.org 2014-07-13 13:39 ` dominiq at lps dot ens.fr 2014-07-13 17:32 ` segher at gcc dot gnu.org 2014-07-14 1:23 ` danglin at gcc dot gnu.org 2014-07-14 8:56 ` rguenth at gcc dot gnu.org [this message] 2014-07-14 9:04 ` rguenth at gcc dot gnu.org 2014-07-14 9:17 ` rguenth at gcc dot gnu.org 2014-07-14 9:48 ` rguenth at gcc dot gnu.org 2014-07-14 10:51 ` rguenth at gcc dot gnu.org 2014-07-14 10:51 ` rguenth at gcc dot gnu.org 2014-07-14 17:57 ` pthaugen at gcc dot gnu.org 2014-07-14 19:15 ` law at redhat dot com 2014-07-15 7:45 ` rguenther at suse dot de 2015-01-16 5:37 ` law at redhat dot com
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-61757-4-fD7JUEkLPR@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).