re PR java/11045 (int cast bug)
authorAndrew Haley <aph@redhat.com>
Wed, 12 Nov 2003 17:00:53 +0000 (17:00 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Wed, 12 Nov 2003 17:00:53 +0000 (17:00 +0000)
2003-11-12  Andrew Haley  <aph@redhat.com>

        PR java/11045
        * parse.y (fold_constant_for_init): Check that we really do have a
        constant.

From-SVN: r73497

gcc/java/ChangeLog
gcc/java/parse.y

index 303e71c..96d03d0 100644 (file)
@@ -1,5 +1,9 @@
 2003-11-12  Andrew Haley  <aph@redhat.com>
 
+       PR java/11045
+       * parse.y (fold_constant_for_init): Check that we really do have a
+       constant.
+
        PR java/11533
        * lang.c (merge_init_test_initialization): Clear DECL_INITIAL for
        init_test_decls being inlined.
index c1b70dd..8a13e51 100644 (file)
@@ -12080,8 +12080,8 @@ java_complete_lhs (tree node)
          /* When we have a primitype type, or a string and we're not
              emitting a class file, we actually don't want to generate
              anything for the assignment. */
-         if (value != NULL_TREE &&
-             (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) ||
+         if (value != NULL_TREE && 
+             (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) || 
               (TREE_TYPE (value) == string_ptr_type_node &&
                ! flag_emit_class_files)))
            {
@@ -16089,7 +16089,11 @@ fold_constant_for_init (tree node, tree context)
       if (val == NULL_TREE || ! TREE_CONSTANT (val))
        return NULL_TREE;
       TREE_OPERAND (node, 0) = val;
-      return patch_unaryop (node, op0);
+      val = patch_unaryop (node, op0);
+      if (! TREE_CONSTANT (val))
+       return NULL_TREE;
+      return val;
+
       break;
 
     case COND_EXPR: