From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6265 invoked by alias); 12 Oct 2004 22:25:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 6247 invoked from network); 12 Oct 2004 22:25:50 -0000 Received: from unknown (HELO smtp1.fuse.net) (216.68.8.174) by sourceware.org with SMTP; 12 Oct 2004 22:25:50 -0000 Received: from gx6.fuse.net ([66.42.242.130]) by smtp1.fuse.net (InterMail vM.6.01.03.04 201-2131-111-106-20040729) with ESMTP id <20041012222550.EMYL708.smtp1.fuse.net@gx6.fuse.net> for ; Tue, 12 Oct 2004 18:25:50 -0400 Received: from dellpi.pinski.fam ([66.42.242.130]) by gx6.fuse.net (InterMail vG.1.00.00.00 201-2136-104-20040331) with ESMTP id <20041012222549.ESWV13281.gx6.fuse.net@dellpi.pinski.fam>; Tue, 12 Oct 2004 18:25:49 -0400 Received: from [10.0.0.80] (zhivago.i.pinski.fam [10.0.0.80]) by dellpi.pinski.fam (8.12.2/8.12.1) with ESMTP id i9CMPFVT024759; Tue, 12 Oct 2004 18:25:45 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <961413EA-1C9D-11D9-BF4C-000A95D692F4@physics.uc.edu> Content-Transfer-Encoding: 7bit Cc: laurent@guerby.net From: Andrew Pinski Subject: [PATCH] Fix c54a13b Date: Tue, 12 Oct 2004 22:31:00 -0000 To: GCC Patches X-SW-Source: 2004-10/txt/msg01050.txt.bz2 The problem here is that types can have non constant min and max values which cause an ICE in stmt.c where we just use tree_int_cst_compare instead of checking to make sure that we have INTEGER_CST. OK? Bootstrapped and tested on powerpc-darwin (Ada's support library still not able to build fully here, I just tested that the testcase now passes). Thanks, Andrew Pinski ChangeLog: * stmt.c (add_case_node): Make sure that we have integer constant before calling tree_int_cst_compare. Index: stmt.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/stmt.c,v retrieving revision 1.398 diff -u -p -r1.398 stmt.c --- stmt.c 11 Oct 2004 16:11:29 -0000 1.398 +++ stmt.c 12 Oct 2004 22:19:31 -0000 @@ -2139,8 +2139,10 @@ add_case_node (struct case_node *head, t if (!high || tree_int_cst_equal (low, high)) { /* If the simple case value is unreachable, ignore it. */ - if (tree_int_cst_compare (low, min_value) < 0 - || tree_int_cst_compare (low, max_value) > 0) + if ((TREE_CODE (min_value) == INTEGER_CST + && tree_int_cst_compare (low, min_value) < 0) + || (TREE_CODE (max_value) == INTEGER_CST + && tree_int_cst_compare (low, max_value) > 0)) return head; low = fold_convert (type, low); high = low; @@ -2148,19 +2150,23 @@ add_case_node (struct case_node *head, t else { /* If the entire case range is unreachable, ignore it. */ - if (tree_int_cst_compare (high, min_value) < 0 - || tree_int_cst_compare (low, max_value) > 0) + if ((TREE_CODE (min_value) == INTEGER_CST + && tree_int_cst_compare (high, min_value) < 0) + || (TREE_CODE (max_value) == INTEGER_CST + && tree_int_cst_compare (low, max_value) > 0)) return head; /* If the lower bound is less than the index type's minimum value, truncate the range bounds. */ - if (tree_int_cst_compare (low, min_value) < 0) + if (TREE_CODE (min_value) == INTEGER_CST + && tree_int_cst_compare (low, min_value) < 0) low = min_value; low = fold_convert (type, low); /* If the upper bound is greater than the index type's maximum value, truncate the range bounds. */ - if (tree_int_cst_compare (high, max_value) > 0) + if (TREE_CODE (max_value) == INTEGER_CST + && tree_int_cst_compare (high, max_value) > 0) high = max_value; high = fold_convert (type, high); }