This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/54070] [4.9/5/6 Regression] Wrong code with allocatable deferred-length (array) function results


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54070

--- Comment #25 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The regression (ICE) is caused by revision r188692 (pr53642). If I apply the
following patch

--- ../_clean/gcc/fortran/trans-expr.c  2015-10-29 17:11:18.000000000 +0100
+++ gcc/fortran/trans-expr.c    2015-11-02 23:44:18.000000000 +0100
@@ -9288,7 +9354,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1
      otherwise the character length of the result is not known.
      NOTE: This relies on having the exact dependence of the length type
      parameter available to the caller; gfortran saves it in the .mod files. 
*/
-  if (flag_realloc_lhs && expr2->ts.type == BT_CHARACTER &&
expr1->ts.deferred)
+  if (flag_realloc_lhs && expr2->ts.type == BT_CHARACTER && expr1->ts.deferred
&& expr2->expr_type != EXPR_VARIABLE)
     gfc_add_block_to_block (&block, &rse.pre);

   /* Nullify the allocatable components corresponding to those of the lhs

the ICEs are gone (it does not mean that the generated code is correct!) but
the test

gfortran.dg/deferred_type_param_8.f90

aborts at run time.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]