This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/30911] VRP fails to eliminate range checks in Ada code
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Mar 2007 09:50:48 -0000
- Subject: [Bug tree-optimization/30911] VRP fails to eliminate range checks in Ada code
- References: <bug-30911-13647@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #39 from rguenth at gcc dot gnu dot org 2007-03-01 09:50 -------
One key point to notice is that the transformation looks at ARG0 op CST where
arg0 and cst don't necessarily have to have the same type (arg0 is reduced from
op0 by STRIP_SIGN_NOPS), so effectively this folds
(Base_Type)x > 10
(where 10 is supposed to be in Base_Type in the interesting case) based on the
value range of x! Now, it also folds
x > 10
with 10 in the derived type but out-of-range constant (created wrongly by
fold, as you noticed). It should be possible to check whether 10 is in
of a derived type and in that case not doing the folding, which is probably
way easier than fixing all of fold not to generate those constants.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30911