module.c (mio_array_ref): The dimen_type fields of an array ref are an enumerated...
authorRoger Sayle <roger@eyesopen.com>
Sat, 20 Jan 2007 20:19:30 +0000 (20:19 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sat, 20 Jan 2007 20:19:30 +0000 (20:19 +0000)
* 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.

From-SVN: r121011

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

index f13d6f894ec582c314673b52f7f1d02d5cf8cdf1..c20c42cf47f27ff4c01b41237908067fa3d3138a 100644 (file)
@@ -1,3 +1,9 @@
+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,
index 1613a740046c59ad27543a179932511b3e309748..650942ed72c3691a66415f880a2419c29096e8a4 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)
     {