]> gcc.gnu.org Git - gcc.git/commitdiff
stmt.c (add_case_node): Make sure that we have integer constant before calling tree_i...
authorAndrew Pinski <pinskia@physics.uc.edu>
Thu, 14 Oct 2004 22:01:45 +0000 (22:01 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Thu, 14 Oct 2004 22:01:45 +0000 (15:01 -0700)
2004-10-14  Andrew Pinski  <pinskia@physics.uc.edu>

        * stmt.c (add_case_node): Make sure that we have integer
        constant before calling tree_int_cst_compare.

From-SVN: r89058

gcc/ChangeLog
gcc/stmt.c

index d36603a72289b45b7e64b22d567dc25edcec76f5..8f4d0337949a5235a8ec1431c2bf72b1f2bbce49 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-14  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       * stmt.c (add_case_node): Make sure that we have integer
+       constant before calling tree_int_cst_compare.
+
 2004-10-14  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR middle-end/17967
index 5560dbc5b2dfa7a8c0b2718e72574e84128a7286..a9bb3e6682ac2d09e3942dcdfdc6acd272dc4bc4 100644 (file)
@@ -2139,8 +2139,10 @@ add_case_node (struct case_node *head, tree type, tree low, tree high,
   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, tree type, tree low, tree high,
   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);
     }
This page took 0.082582 seconds and 5 git commands to generate.