Commit 128e09f9 by Thomas Koenig

re PR fortran/48412 (CP2K miscompiled due to some Fortran frontend pass)

2011-04-04  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/48412
	* frontend-passes (cfe_expr_0):  Reverse the order of going
	through the loops.

2011-04-04  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/48412
	* function_optimize_4.f90:  New test.

From-SVN: r171952
parent e5b0e1ca
2011-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48412
* frontend-passes (cfe_expr_0): Reverse the order of going
through the loops.
2011-04-04 Tobias Burnus <burnus@net-b.de>
Mikael Morin <mikael.morin@sfr.fr>
......
......@@ -295,16 +295,16 @@ cfe_expr_0 (gfc_expr **e, int *walk_subtrees,
gfc_expr_walker (e, cfe_register_funcs, NULL);
/* Walk backwards through all the functions to make sure we
catch the leaf functions first. */
for (i=expr_count-1; i>=1; i--)
/* Walk through all the functions. */
for (i=1; i<expr_count; i++)
{
/* Skip if the function has been replaced by a variable already. */
if ((*(expr_array[i]))->expr_type == EXPR_VARIABLE)
continue;
newvar = NULL;
for (j=i-1; j>=0; j--)
for (j=0; j<i; j++)
{
if (gfc_dep_compare_functions(*(expr_array[i]),
*(expr_array[j]), true) == 0)
......
2011-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48412
* function_optimize_4.f90: New test.
2011-04-04 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
......
! { dg-do run }
! { dg-options "-O" }
! PR 48412 - function elimination got temporary varibles in the wrong order.
! Test case contributed by Joost VandeVondele.
INTEGER FUNCTION S1(m,ma,lx)
INTEGER :: m,ma,lx
IF (((m < 0).AND.(MODULO(ABS(ma-lx),2) == 1)).OR.&
((m > 0).AND.(MODULO(ABS(ma-lx),2) == 0))) THEN
S1=1
ELSE
S1=0
ENDIF
END FUNCTION
INTEGER :: s1
IF (S1(1,2,1).NE.0) 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