------- Comment #1 from pinskia at gcc dot gnu dot org  2006-12-24 05:25 -------
Reduced testcase:
program gfcbug51
  type date_t
     character(len=12) :: date
  end type date_t
  type(date_t) :: file(1)
  read (file%date(1:4),'(i4)') a
end program gfcbug51
------------------------------
Here is a patch which fixes the issue too:
Index: trans-io.c
===================================================================
--- trans-io.c  (revision 120165)
+++ trans-io.c  (working copy)
@@ -635,7 +635,7 @@ set_internal_unit (stmtblock_t * block,
   /* The cast is needed for character substrings and the descriptor
      data.  */
   gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), tmp));
-  gfc_add_modify_expr (&se.pre, len, se.string_length);
+  gfc_add_modify_expr (&se.pre, len, fold_convert (TREE_TYPE (len),
se.string_length));
   gfc_add_modify_expr (&se.pre, desc, se.expr);

   gfc_add_block_to_block (block, &se.pre);


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2006-12-24 05:25:13
               date|                            |
            Summary|ICE in gfc_add_modify, at   |ICE in gfc_add_modify with
                   |fortran/trans.c:159         |internal reads


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30284

Reply via email to