------- Comment #8 from fxcoudert at gcc dot gnu dot org  2007-05-19 18:34 
-------
Andrew Pinski noticed on IRC a type mismatch in the generated code, that leads
to this wrong-code. This ptach fixes it, I'm regtesting it right now.

Index: trans-array.c
===================================================================
--- trans-array.c       (revision 124856)
+++ trans-array.c       (working copy)
@@ -3846,7 +3846,8 @@ gfc_trans_auto_array_allocation (tree de
   /* The size is the number of elements in the array, so multiply by the
      size of an element to get the total size.  */
   tmp = TYPE_SIZE_UNIT (gfc_get_element_type (type));
-  size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, tmp);
+  size = fold_build2 (MULT_EXPR, gfc_array_index_type, size,
+                     fold_convert (gfc_array_index_type, tmp));

   /* Allocate memory to hold the data.  */
   tmp = gfc_call_malloc (&block, TREE_TYPE (decl), size);


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
          Component|tree-optimization           |fortran
           Keywords|ice-on-valid-code           |patch, wrong-code
   Last reconfirmed|2007-05-19 18:16:20         |2007-05-19 18:34:53
               date|                            |


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

Reply via email to