OSDN Git Service

PR fortran/50420
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Oct 2011 15:17:29 +0000 (15:17 +0000)
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Oct 2011 15:17:29 +0000 (15:17 +0000)
* trans.c (gfc_build_array_ref): If type is not an array, check that
there is nothing to do, and do nothing.

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

gcc/fortran/ChangeLog
gcc/fortran/trans.c

index f8105b1..f7a793f 100644 (file)
@@ -1,6 +1,12 @@
 2011-10-18  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/50420
 2011-10-18  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/50420
+       * trans.c (gfc_build_array_ref): If type is not an array, check that
+       there is nothing to do, and do nothing.
+
+2011-10-18  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/50420
        * trans-types.c (gfc_build_array_type): Don't force lower bound to one
        in the deferred case.
 
        * trans-types.c (gfc_build_array_type): Don't force lower bound to one
        in the deferred case.
 
index 0176aec..88bd389 100644 (file)
@@ -323,7 +323,14 @@ gfc_build_array_ref (tree base, tree offset, tree decl)
       return fold_convert (TYPE_MAIN_VARIANT (type), base);
     }
 
       return fold_convert (TYPE_MAIN_VARIANT (type), base);
     }
 
-  gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
+  /* Scalar coarray, there is nothing to do.  */
+  if (TREE_CODE (type) != ARRAY_TYPE)
+    {
+      gcc_assert (decl == NULL_TREE);
+      gcc_assert (integer_zerop (offset));
+      return base;
+    }
+
   type = TREE_TYPE (type);
 
   if (DECL_P (base))
   type = TREE_TYPE (type);
 
   if (DECL_P (base))