From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8856 invoked by alias); 1 Mar 2007 09:50:59 -0000 Received: (qmail 8810 invoked by uid 48); 1 Mar 2007 09:50:48 -0000 Date: Thu, 01 Mar 2007 09:50:00 -0000 Message-ID: <20070301095048.8809.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/30911] VRP fails to eliminate range checks in Ada code In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" 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 X-SW-Source: 2007-03/txt/msg00016.txt.bz2 ------- 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