Commit 61f70bf2 by Francois-Xavier Coudert Committed by François-Xavier Coudert

re PR fortran/31974 ([4.2]: array allocation multiplication of mismatched types)

	PR fortran/31974

	* trans-array.c (gfc_trans_auto_array_allocation): Avoid
	multiplication of mismatched types.

	* gfortran.dg/char_allocation_1.f90: New test.

From-SVN: r124858
parent e9d41616
2007-05-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31974
* trans-array.c (gfc_trans_auto_array_allocation): Avoid
multiplication of mismatched types.
2007-05-18 Daniel Franke <franke.daniel@gmail.com> 2007-05-18 Daniel Franke <franke.daniel@gmail.com>
PR fortran/24633 PR fortran/24633
......
...@@ -3846,7 +3846,8 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) ...@@ -3846,7 +3846,8 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
/* The size is the number of elements in the array, so multiply by the /* The size is the number of elements in the array, so multiply by the
size of an element to get the total size. */ size of an element to get the total size. */
tmp = TYPE_SIZE_UNIT (gfc_get_element_type (type)); 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. */ /* Allocate memory to hold the data. */
tmp = gfc_call_malloc (&block, TREE_TYPE (decl), size); tmp = gfc_call_malloc (&block, TREE_TYPE (decl), size);
......
2007-05-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31974
* gfortran.dg/char_allocation_1.f90: New test.
2007-05-19 Manuel Lopez-Ibanez <manu@gcc.gnu.org> 2007-05-19 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* gcc.dg/Wconversion-integer.c: Group testcases and add more. * gcc.dg/Wconversion-integer.c: Group testcases and add more.
! PR fortran/31974
! { dg-do run }
subroutine foo (n)
integer :: n
character (len = n) :: v(n)
v = ''
if (any (v /= '')) call abort
end subroutine foo
call foo(7)
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment