OSDN Git Service

2008-02-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Feb 2008 22:50:25 +0000 (22:50 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Feb 2008 22:50:25 +0000 (22:50 +0000)
PR fortran/35059
* expr.c (find_array_element): Modify traversing the constructor to
avoid trying to access NULL memory pointed to by next for the
last element. (find_array_section): Exit while loop if cons->next is
NULL.
* trans-expr.c (gfc_conv_scalar_char_value): Initialize gfc_typespec.
(gfc_conv_function_call): Same.
* decl.c (gfc_match_implicit): Same.
* trans-intrinsic.c (gfc_conv_intrinsic_sr_kind): Same.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132782 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/fortran/expr.c
gcc/fortran/trans-expr.c
gcc/fortran/trans-intrinsic.c

index 20e5ae3..841c9d4 100644 (file)
@@ -1,3 +1,15 @@
+2008-02-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/35059
+       * expr.c (find_array_element): Modify traversing the constructor to
+       avoid trying to access NULL memory pointed to by next for the
+       last element. (find_array_section): Exit while loop if cons->next is
+       NULL.
+       * trans-expr.c (gfc_conv_scalar_char_value): Initialize gfc_typespec.
+       (gfc_conv_function_call): Same.
+       * decl.c (gfc_match_implicit): Same.
+       * trans-intrinsic.c (gfc_conv_intrinsic_sr_kind): Same.
+
 2008-02-28  Daniel Franke  <franke.daniel@gmail.com>
 
        PR fortran/31463
index d830687..892c80a 100644 (file)
@@ -2506,6 +2506,8 @@ gfc_match_implicit (void)
   int c;
   match m;
 
+  gfc_clear_ts (&ts);
+
   /* We don't allow empty implicit statements.  */
   if (gfc_match_eos () == MATCH_YES)
     {
index 0b0fd09..329bc72 100644 (file)
@@ -1051,18 +1051,19 @@ find_array_element (gfc_constructor *cons, gfc_array_ref *ar,
       mpz_mul (span, span, tmp);
     }
 
-  if (cons)
-    {
-      for (nelemen = mpz_get_ui (offset); nelemen > 0; nelemen--)
-       {
-         if (cons->iterator)
-           {
-             cons = NULL;
-             goto depart;
-           }
-         cons = cons->next;
-       }
-    }
+    for (nelemen = mpz_get_ui (offset); nelemen > 0; nelemen--)
+      {
+        if (cons)
+         {
+           if (cons->iterator)
+             {
+               cons = NULL;
+             
+               goto depart;
+             }
+           cons = cons->next;
+         }
+      }
 
 depart:
   mpz_clear (delta);
@@ -1341,7 +1342,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
          cons = base;
        }
 
-      while (mpz_cmp (ptr, index) > 0)
+      while (cons && cons->next && mpz_cmp (ptr, index) > 0)
        {
          mpz_add_ui (index, index, one);
          cons = cons->next;
index a348451..9b33d37 100644 (file)
@@ -1275,6 +1275,7 @@ gfc_conv_scalar_char_value (gfc_symbol *sym, gfc_se *se, gfc_expr **expr)
       if ((*expr)->expr_type == EXPR_CONSTANT)
         {
          gfc_typespec ts;
+          gfc_clear_ts (&ts);
 
          *expr = gfc_int_expr ((int)(*expr)->value.character.string[0]);
          if ((*expr)->ts.kind != gfc_c_int_kind)
@@ -2250,6 +2251,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
   stringargs = NULL_TREE;
   var = NULL_TREE;
   len = NULL_TREE;
+  gfc_clear_ts (&ts);
 
   if (sym->from_intmod == INTMOD_ISO_C_BINDING)
     {
index 77bad73..49f2094 100644 (file)
@@ -3764,6 +3764,8 @@ gfc_conv_intrinsic_sr_kind (gfc_se *se, gfc_expr *expr)
       else
        {
          gfc_typespec ts;
+          gfc_clear_ts (&ts);
+
          if (actual->expr->ts.kind != gfc_c_int_kind)
            {
              /* The arguments to SELECTED_REAL_KIND are INTEGER(4).  */