Commit 258bd5dc by Jakub Jelinek Committed by Jakub Jelinek

trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): For integer maxloc initialize…

trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): For integer maxloc initialize limit to -huge-1 rather than just -huge.

	* trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): For integer
	maxloc initialize limit to -huge-1 rather than just -huge.

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

From-SVN: r149236
parent bd5b2c2d
2009-07-04 Jakub Jelinek <jakub@redhat.com>
* trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): For integer
maxloc initialize limit to -huge-1 rather than just -huge.
2009-07-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/40593
......
......@@ -2190,12 +2190,12 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
possible value is HUGE in both cases. */
if (op == GT_EXPR)
tmp = fold_build1 (NEGATE_EXPR, TREE_TYPE (tmp), tmp);
gfc_add_modify (&se->pre, limit, tmp);
if (op == GT_EXPR && expr->ts.type == BT_INTEGER)
tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (tmp), tmp,
build_int_cst (type, 1));
gfc_add_modify (&se->pre, limit, tmp);
/* Initialize the scalarizer. */
gfc_init_loopinfo (&loop);
gfc_add_ss_to_loop (&loop, arrayss);
......
2009-07-04 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/maxloc_1.f90: New test.
2009-07-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/40593
......
! { dg-do run }
integer :: a(3), n
a(1) = -huge(n)
a(2) = -huge(n)
a(3) = -huge(n)
a(1) = a(1) - 1
a(2) = a(2) - 1
a(3) = a(3) - 1
n = maxloc (a, dim = 1)
if (n .ne. 1) call abort
a(2) = -huge(n)
n = maxloc (a, dim = 1)
if (n .ne. 2) call abort
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