Commit 23360fe4 by Thomas Koenig

function_optimize_1.f90: Add -Warray-temporaries, check for corresponding warning.

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

	* gfortran.dg/function_optimize_1.f90:  Add -Warray-temporaries,
	check for corresponding warning.

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

	* frontend-passes.c (create_var):  Warn about creating an
	array temporary if requested.

From-SVN: r171653
parent b7469e03
2011-03-29 Thomas Koenig <tkoenig@gcc.gnu.org>
* frontend-passes.c (create_var): Warn about creating an
array temporary if requested.
2011-03-27 Thomas Koenig <tkoenig@gcc.gnu.org> 2011-03-27 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/47065 PR fortran/47065
* frontend-passes (optimize_trim): Also follow references, except * frontend-passes.c (optimize_trim): Also follow references, except
when they are substring references or array references. when they are substring references or array references.
2011-03-27 Tobias Burnus <burnus@net-b.de> 2011-03-27 Tobias Burnus <burnus@net-b.de>
......
...@@ -256,6 +256,8 @@ create_var (gfc_expr * e) ...@@ -256,6 +256,8 @@ create_var (gfc_expr * e)
result->ref->u.ar.type = AR_FULL; result->ref->u.ar.type = AR_FULL;
result->ref->u.ar.where = e->where; result->ref->u.ar.where = e->where;
result->ref->u.ar.as = symbol->as; result->ref->u.ar.as = symbol->as;
if (gfc_option.warn_array_temp)
gfc_warning ("Creating array temporary at %L", &(e->where));
} }
/* Generate the new assignment. */ /* Generate the new assignment. */
......
2011-03-29 Thomas Koenig <tkoenig@gcc.gnu.org>
* gfortran.dg/function_optimize_1.f90: Add -Warray-temporaries,
check for corresponding warning.
2011-03-28 Jason Merrill <jason@redhat.com> 2011-03-28 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/rv-deduce2.C: New. * g++.dg/cpp0x/rv-deduce2.C: New.
......
! { dg-do compile } ! { dg-do compile }
! { dg-options "-O -fdump-tree-original" } ! { dg-options "-O -fdump-tree-original -Warray-temporaries" }
program main program main
implicit none implicit none
real, dimension(2,2) :: a, b, c, d real, dimension(2,2) :: a, b, c, d
...@@ -24,7 +24,8 @@ program main ...@@ -24,7 +24,8 @@ program main
data a /2., 3., 5., 7./ data a /2., 3., 5., 7./
data b /11., 13., 17., 23./ data b /11., 13., 17., 23./
write (unit=line, fmt='(4F7.2)') matmul(a,b) + matmul(a,b) write (unit=line, fmt='(4F7.2)') matmul(a,b) &
& + matmul(a,b) ! { dg-warning "Creating array temporary" }
z = sin(x) + cos(x) + sin(x) + cos(x) z = sin(x) + cos(x) + sin(x) + cos(x)
print *,z print *,z
x = ext_func(a) + 23 + ext_func(a) x = ext_func(a) + 23 + ext_func(a)
......
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