public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/30911] VRP fails to eliminate range checks in Ada code Date: Thu, 22 Feb 2007 17:04:00 -0000 [thread overview] Message-ID: <20070222170433.20624.qmail@sourceware.org> (raw) In-Reply-To: <bug-30911-13647@http.gcc.gnu.org/bugzilla/> ------- Comment #4 from rguenth at gcc dot gnu dot org 2007-02-22 17:04 ------- Can you walk me through some of the checks and why they can be removed? I see (.004.gimple dump): source = source_first; target = target_first; source_last.0 = (js__TsB) source_last; source_first.1 = (js__TsB) source_first; if (source_last.0 < source_first.1) { if (target_first == 10) { __gnat_rcheck_04 ("join_equal.adb", 13); } else { } if (target_first == 128) { __gnat_rcheck_12 ("join_equal.adb", 15); iftmp.2 = target_first; } else { iftmp.2 = target_first; } iftmp.3 = iftmp.2; iftmp.4 = (js__TtB) iftmp.3; if (iftmp.4 <= 10) { goto <D1039>; } else { } iftmp.4 = (js__TtB) iftmp.3; if (iftmp.4 > 21) { goto <D1039>; } else { goto <D1040>; } <D1039>:; __gnat_rcheck_12 ("join_equal.adb", 15); <D1040>:; if (target_first == 128) { __gnat_rcheck_12 ("join_equal.adb", 15); iftmp.5 = target_first; } else { iftmp.5 = target_first; } iftmp.6 = iftmp.5; iftmp.7 = (js__TtB) iftmp.6; D.1047 = iftmp.7 + -1; target_last = (j__target_type___XDLU_10__20) D.1047; goto <D1016>; I assume all of the above is gimplified from just if Source_Last < Source_First then if Target_First = Target_Type'First then raise Constraint_Error; end if; Target_Last := Target_Type'Pred (Target_First); return; ? So in essence VRP should somehow be able to see that Target_Type'Pred (Target_First) cannot be out of bounds because Target_First is not Target_Type'First, correct? But given the gimplified form above we also need to prove Target_First is not 128 (where does that come from? It looks like __gnat_rcheck_12 is not a noreturn function?). We also need to prove that (js__TtB) Target_First is > 10 (that looks doable from the != 10 range we can extract from the first range check). But where does the check against 21 come from? The 2nd check for 128 looks redundant and indeed we remove it in VRP1. I need to look closer at what js__TtB actually is looking like, but this is at least a useful testcase. Thanks. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30911
next prev parent reply other threads:[~2007-02-22 17:04 UTC|newest] Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-02-21 13:57 [Bug tree-optimization/30911] New: " baldrick at gcc dot gnu dot org 2007-02-21 15:18 ` [Bug tree-optimization/30911] " baldrick at gcc dot gnu dot org 2007-02-21 17:55 ` steven at gcc dot gnu dot org 2007-02-21 18:01 ` ebotcazou at gcc dot gnu dot org 2007-02-22 17:04 ` rguenth at gcc dot gnu dot org [this message] 2007-02-22 17:33 ` ebotcazou at gcc dot gnu dot org 2007-02-22 17:41 ` baldrick at gcc dot gnu dot org 2007-02-22 18:01 ` ebotcazou at gcc dot gnu dot org 2007-02-22 18:14 ` baldrick at gcc dot gnu dot org 2007-02-22 18:18 ` baldrick at gcc dot gnu dot org 2007-02-22 18:19 ` ebotcazou at gcc dot gnu dot org 2007-02-22 22:54 ` baldrick at gcc dot gnu dot org 2007-02-23 5:50 ` ebotcazou at gcc dot gnu dot org 2007-02-23 9:22 ` rguenth at gcc dot gnu dot org 2007-02-23 9:39 ` baldrick at free dot fr 2007-02-23 10:03 ` baldrick at free dot fr 2007-02-23 11:37 ` rguenth at gcc dot gnu dot org 2007-02-23 11:42 ` rguenth at gcc dot gnu dot org 2007-02-23 12:36 ` baldrick at free dot fr 2007-02-23 12:41 ` rguenth at gcc dot gnu dot org 2007-02-23 13:05 ` baldrick at free dot fr 2007-02-23 14:05 ` rguenth at gcc dot gnu dot org 2007-02-23 15:15 ` rguenth at gcc dot gnu dot org 2007-02-23 15:40 ` baldrick at free dot fr 2007-02-23 15:55 ` rguenth at gcc dot gnu dot org 2007-02-23 15:59 ` baldrick at free dot fr 2007-02-23 16:01 ` baldrick at free dot fr 2007-02-23 16:05 ` charlet at gcc dot gnu dot org 2007-02-23 16:11 ` rguenth at gcc dot gnu dot org 2007-02-23 17:09 ` baldrick at free dot fr 2007-02-23 17:33 ` rguenth at gcc dot gnu dot org 2007-02-23 20:18 ` rguenth at gcc dot gnu dot org 2007-02-23 22:40 ` rguenth at gcc dot gnu dot org 2007-02-24 10:12 ` Arnaud Charlet 2007-02-24 12:32 ` Arnaud Charlet 2007-02-24 10:12 ` charlet at adacore dot com 2007-02-24 12:32 ` charlet at adacore dot com 2007-02-24 12:38 ` rguenth at gcc dot gnu dot org 2007-02-24 12:47 ` Arnaud Charlet 2007-02-24 12:48 ` charlet at adacore dot com 2007-02-28 23:30 ` baldrick at free dot fr 2007-03-01 8:18 ` baldrick at free dot fr 2007-03-01 9:50 ` rguenth at gcc dot gnu dot org 2007-03-01 23:07 ` baldrick at free dot fr 2007-03-02 9:02 ` rguenth at gcc dot gnu dot org 2007-03-02 9:16 ` baldrick at free dot fr 2007-03-02 9:53 ` rguenth at gcc dot gnu dot org 2008-03-28 12:21 ` rguenth at gcc dot gnu dot org 2008-03-28 14:59 ` baldrick at gcc dot gnu dot org 2008-03-28 19:19 ` rguenth at gcc dot gnu dot org 2008-03-28 22:13 ` rguenth at gcc dot gnu dot org 2008-03-28 22:15 ` rguenth at gcc dot gnu dot org 2008-03-28 22:36 ` rguenth at gcc dot gnu dot org 2008-03-28 22:43 ` baldrick at free dot fr 2008-03-28 22:49 ` baldrick at free dot fr 2008-03-28 22:59 ` rguenth at gcc dot gnu dot org 2008-03-30 9:15 ` ebotcazou at gcc dot gnu dot org 2008-03-30 14:15 ` baldrick at gcc dot gnu dot org 2008-03-30 14:19 ` baldrick at gcc dot gnu dot org 2008-03-30 14:27 ` baldrick at free dot fr 2008-03-30 14:53 ` rguenther at suse dot de 2008-03-30 14:56 ` rguenth at gcc dot gnu dot org 2008-03-30 15:03 ` ebotcazou at gcc dot gnu dot org 2008-03-30 15:09 ` rguenth at gcc dot gnu dot org 2008-03-30 15:17 ` baldrick at free dot fr 2008-03-30 15:46 ` ebotcazou at gcc dot gnu dot org 2008-03-30 15:56 ` rguenther at suse dot de 2008-03-30 16:03 ` baldrick at free dot fr 2008-03-30 16:16 ` ebotcazou at gcc dot gnu dot org 2008-03-30 16:19 ` ebotcazou at gcc dot gnu dot org 2008-03-30 17:04 ` baldrick at free dot fr 2008-04-03 19:53 ` rguenth at gcc dot gnu dot org 2009-11-17 11:04 ` baldrick at free dot fr 2009-11-17 11:19 ` ebotcazou at gcc dot gnu dot org 2009-11-17 15:08 ` rguenther at suse dot de 2009-11-17 15:50 ` Arnaud Charlet 2009-11-17 15:50 ` charlet at adacore dot com 2009-11-17 16:57 ` baldrick at free dot fr 2009-11-17 17:03 ` charlet at gcc dot gnu dot 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=20070222170433.20624.qmail@sourceware.org \ --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).