fold-const.c (make_range): Don't go looking at TREE_OPERANDs of nodes that are not...
authorMark Mitchell <mark@markmitchell.com>
Thu, 25 Jun 1998 17:28:11 +0000 (17:28 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 25 Jun 1998 17:28:11 +0000 (17:28 +0000)
* fold-const.c (make_range): Don't go looking at TREE_OPERANDs of
nodes that are not expressions.

From-SVN: r20728

gcc/ChangeLog
gcc/fold-const.c

index b9ada6d08513366c6814a57af848dfd70e27ebd1..9ecab59ee7425c0082eed8b8a4a6002c5f948d8d 100644 (file)
@@ -1,3 +1,8 @@
+Thu Jun 25 12:47:41 1998  Mark Mitchell  <mark@markmitchell.com>
+
+       * fold-const.c (make_range): Don't go looking at TREE_OPERANDs of
+       nodes that are not expressions.
+
 Thu Jun 25 15:08:16 1998  Mark Mitchell  <mark@markmitchell.com>
 
        * invoke.texi (-fstrict-aliasing): Document.
index 30499a178dec3ca8b9fe862390e6cf338ce4bce9..7544f8b673acb0c8b3e2db71376a3a42177a853b 100644 (file)
@@ -2836,10 +2836,20 @@ make_range (exp, pin_p, plow, phigh)
   while (1)
     {
       code = TREE_CODE (exp);
-      arg0 = TREE_OPERAND (exp, 0), arg1 = TREE_OPERAND (exp, 1);
-      if (TREE_CODE_CLASS (code) == '<' || TREE_CODE_CLASS (code) == '1'
-         || TREE_CODE_CLASS (code) == '2')
-       type = TREE_TYPE (arg0);
+
+      if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
+       {
+         arg0 = TREE_OPERAND (exp, 0);
+         if (TREE_CODE_CLASS (code) == '<' 
+             || TREE_CODE_CLASS (code) == '1'
+             || TREE_CODE_CLASS (code) == '2')
+           type = TREE_TYPE (arg0);
+         if (TREE_CODE_CLASS (code) == '2' 
+             || TREE_CODE_CLASS (code) == '<'
+             || (TREE_CODE_CLASS (code) == 'e' 
+                 && tree_code_length[(int) code] > 1))
+           arg1 = TREE_OPERAND (exp, 1);
+       }
 
       switch (code)
        {