]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re GNATS gcj/94 (compiler allows assignment to interface constants)
authorAlexandre Petit-Bianco <apbianco@cygnus.com>
Wed, 8 Mar 2000 00:30:06 +0000 (00:30 +0000)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Wed, 8 Mar 2000 00:30:06 +0000 (16:30 -0800)
2000-02-22  Alexandre Petit-Bianco  <apbianco@cygnus.com>

* parse.y (check_final_assignment): Extended to process
COMPOUND_EXPR.
(patch_assignment): Have check_final_assignment called only once.

(This fixes the Java PR #94:
 http://sourceware.cygnus.com/ml/java-prs/1999-q4/msg00125.html)

From-SVN: r32396

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

index a125f421baae599b589baf4b00e61e18c82cc4cc..205e8475a84b3617970b882297b0cb90ff10a56b 100644 (file)
@@ -1,3 +1,9 @@
+2000-03-07  Alexandre Petit-Bianco  <apbianco@cygnus.com>
+
+       * parse.y (check_final_assignment): Extended to process
+       COMPOUND_EXPR.
+       (patch_assignment): Have check_final_assignment called only once.
+
 2000-03-07  Alexandre Petit-Bianco  <apbianco@cygnus.com>
 
        * java-tree.h (IS_INIT_CHECKED): New flag.
index c01910138bd334acf6b7897d58a869a71c035589..59a1b5a5405a2f36ef25cd5a69f6e4b1d0525087 100644 (file)
@@ -11771,6 +11771,10 @@ static int
 check_final_assignment (lvalue, wfl)
      tree lvalue, wfl;
 {
+  if (TREE_CODE (lvalue) == COMPOUND_EXPR 
+      && JDECL_P (TREE_OPERAND (lvalue, 1)))
+    lvalue = TREE_OPERAND (lvalue, 1);
+
   if (JDECL_P (lvalue) 
       && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl))
     {
@@ -11850,7 +11854,7 @@ patch_assignment (node, wfl_op1, wfl_op2)
   else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
           && resolve_expression_name (wfl_op1, &llvalue))
     {
-      if (check_final_assignment (llvalue, wfl_op1))
+      if (!error_found && check_final_assignment (llvalue, wfl_op1))
        {
          /* What we should do instead is resetting the all the flags
             previously set, exchange lvalue for llvalue and continue. */
@@ -13516,9 +13520,11 @@ patch_newarray (node)
   for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim))
     {
       type = array_type;
-      array_type = build_java_array_type (type,
-                                         TREE_CODE (cdim) == INTEGER_CST ?
-                                         TREE_INT_CST_LOW (cdim) : -1);
+      array_type
+       = build_java_array_type (type,
+                                TREE_CODE (cdim) == INTEGER_CST
+                                ? (HOST_WIDE_INT) TREE_INT_CST_LOW (cdim)
+                                : -1);
       array_type = promote_type (array_type);
     }
   dims = nreverse (dims);
index 2196968a5f39f6ffa560a2ef1131e5dfc19055f2..1d8d68b930f422f88325d0afc04eddcf4baccca9 100644 (file)
@@ -9081,6 +9081,10 @@ static int
 check_final_assignment (lvalue, wfl)
      tree lvalue, wfl;
 {
+  if (TREE_CODE (lvalue) == COMPOUND_EXPR 
+      && JDECL_P (TREE_OPERAND (lvalue, 1)))
+    lvalue = TREE_OPERAND (lvalue, 1);
+
   if (JDECL_P (lvalue) 
       && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl))
     {
@@ -9160,7 +9164,7 @@ patch_assignment (node, wfl_op1, wfl_op2)
   else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
           && resolve_expression_name (wfl_op1, &llvalue))
     {
-      if (check_final_assignment (llvalue, wfl_op1))
+      if (!error_found && check_final_assignment (llvalue, wfl_op1))
        {
          /* What we should do instead is resetting the all the flags
             previously set, exchange lvalue for llvalue and continue. */