OSDN Git Service

* module.c (mio_array_ref): The dimen_type fields of an array ref
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 20 Jan 2007 20:19:30 +0000 (20:19 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 20 Jan 2007 20:19:30 +0000 (20:19 +0000)
are an enumerated type and can't be read/written directly with a
call to mio_integer.  Instead loop over and cast each element.

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

gcc/fortran/ChangeLog
gcc/fortran/module.c

index f13d6f8..c20c42c 100644 (file)
@@ -1,5 +1,11 @@
 2007-01-20  Roger Sayle  <roger@eyesopen.com>
 
+       * module.c (mio_array_ref): The dimen_type fields of an array ref
+       are an enumerated type and can't be read/written directly with a
+       call to mio_integer.  Instead loop over and cast each element.
+
+2007-01-20  Roger Sayle  <roger@eyesopen.com>
+
        * dependency.c (gfc_full_array_ref_p): Check that ref->next is NULL,
        i.e. that the ARRAY_REF doesn't mention components.
        * trans-array.c (gfc_constant_array_constructor_p): Export external
index 1613a74..650942e 100644 (file)
@@ -1913,8 +1913,25 @@ mio_array_ref (gfc_array_ref * ar)
       gfc_internal_error ("mio_array_ref(): Unknown array ref");
     }
 
-  for (i = 0; i < ar->dimen; i++)
-    mio_integer ((int *) &ar->dimen_type[i]);
+  /* Unfortunately, ar->dimen_type is an anonymous enumerated type so
+     we can't call mio_integer directly.  Instead loop over each element
+     and cast it to/from an integer.  */
+  if (iomode == IO_OUTPUT)
+    {
+      for (i = 0; i < ar->dimen; i++)
+       {
+         int tmp = (int)ar->dimen_type[i];
+         write_atom (ATOM_INTEGER, &tmp);
+       }
+    }
+  else
+    {
+      for (i = 0; i < ar->dimen; i++)
+       {
+         require_atom (ATOM_INTEGER);
+         ar->dimen_type[i] = atom_int;
+       }
+    }
 
   if (iomode == IO_INPUT)
     {