expr.c (safe_from_p): Change code to ERROR_MARK only when not accessing nodes.
authorJason Merrill <jason@gcc.gnu.org>
Thu, 13 Aug 1998 16:12:55 +0000 (12:12 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 13 Aug 1998 16:12:55 +0000 (12:12 -0400)
* expr.c (safe_from_p): Change code to ERROR_MARK only when not
accessing nodes.
* toplev.c (display_help): Add braces to shut up warnings.
* fold-const.c (non_lvalue): Don't deal with null pointer
constants here.
(fold, case COMPOUND_EXPR): Wrap a constant 0 in a NOP_EXPR.

From-SVN: r21698

gcc/ChangeLog
gcc/expr.c
gcc/fold-const.c
gcc/toplev.c

index 35e2e6cd9098fb8be8285d205a6075fc6b61ec0e..9c33025ce641b3b918b192c0a8bcf8e05ea8ae30 100644 (file)
@@ -1,5 +1,16 @@
+Thu Aug 13 16:09:53 1998  Martin von Loewis  <loewis@informatik.hu-berlin.de>
+
+       * expr.c (safe_from_p): Change code to ERROR_MARK only when not
+       accessing nodes.
+
 Thu Aug 13 15:24:48 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * toplev.c (display_help): Add braces to shut up warnings.
+
+       * fold-const.c (non_lvalue): Don't deal with null pointer 
+       constants here.
+       (fold, case COMPOUND_EXPR): Wrap a constant 0 in a NOP_EXPR.
+
        * c-typeck.c (initializer_constant_valid_p): Allow conversion of 0
        of any size to a pointer.
 
index 208db5cb2d871cea3f1c330edf0398d45fdf8677..7f1b35f859e069988a32ad4b732042e6815a018c 100644 (file)
@@ -4983,13 +4983,19 @@ safe_from_p (x, exp, top_p)
          if (save_expr_count >= save_expr_size)
            return 0;
          save_expr_rewritten[save_expr_count++] = exp;
-         TREE_SET_CODE (exp, ERROR_MARK);
 
          nops = tree_code_length[(int) SAVE_EXPR];
          for (i = 0; i < nops; i++)
-           if (TREE_OPERAND (exp, i) != 0
-               && ! safe_from_p (x, TREE_OPERAND (exp, i), 0))
-             return 0;
+           {
+             tree operand = TREE_OPERAND (exp, i);
+             if (operand == NULL_TREE)
+               continue;
+             TREE_SET_CODE (exp, ERROR_MARK);
+             if (!safe_from_p (x, operand, 0))
+               return 0;
+             TREE_SET_CODE (exp, SAVE_EXPR);
+           }
+         TREE_SET_CODE (exp, ERROR_MARK);
          return 1;
 
        case BIND_EXPR:
index 4fe689944542ead5f959422b45d5e6542c2bbd0b..c84d52c9724a02802e20e8059f878034ae61ca91 100644 (file)
@@ -1679,8 +1679,7 @@ fold_convert (t, arg1)
   return t;
 }
 \f
-/* Return an expr equal to X but certainly not valid as an lvalue.
-   Also make sure it is not valid as an null pointer constant.  */
+/* Return an expr equal to X but certainly not valid as an lvalue.  */
 
 tree
 non_lvalue (x)
@@ -1694,18 +1693,7 @@ non_lvalue (x)
       || TREE_CODE (x) == REAL_CST
       || TREE_CODE (x) == STRING_CST
       || TREE_CODE (x) == ADDR_EXPR)
-    {
-      if (TREE_CODE (x) == INTEGER_CST && integer_zerop (x))
-       {
-         /* Use NOP_EXPR instead of NON_LVALUE_EXPR
-            so convert_for_assignment won't strip it.
-            This is so this 0 won't be treated as a null pointer constant.  */
-         result = build1 (NOP_EXPR, TREE_TYPE (x), x);
-         TREE_CONSTANT (result) = TREE_CONSTANT (x);
-         return result;
-       }
-      return x;
-    }
+    return x;
 
   result = build1 (NON_LVALUE_EXPR, TREE_TYPE (x), x);
   TREE_CONSTANT (result) = TREE_CONSTANT (x);
@@ -6060,7 +6048,7 @@ fold (expr)
        return t;
       /* Don't let (0, 0) be null pointer constant.  */
       if (integer_zerop (arg1))
-       return non_lvalue (arg1);
+       return build1 (NOP_EXPR, TREE_TYPE (arg1), arg1);
       return arg1;
 
     case COMPLEX_EXPR:
index 9ab6435ab308312040033a9c4cd49dbc1b9dbd24..63e85aa3a831e5d2db7faa01570f40897516d9cf 100644 (file)
@@ -4094,10 +4094,12 @@ display_help ()
        }
 #endif
       if (undoc)
-       if (doc)
-         printf ("\nThere are undocumented target specific options as well.\n");
-       else
-         printf ("  They exist, but they are not documented.\n");
+       {
+         if (doc)
+           printf ("\nThere are undocumented target specific options as well.\n");
+         else
+           printf ("  They exist, but they are not documented.\n");
+       }
     }
 }