PR fortran/29060
* iresolve.c (resolve_spread): Build shape for result if the
source shape is available and dim and ncopies are constants.
PR fortran/28817
PR fortran/21918
* trans-decl.c (generate_local_decl): Change from 'warning' to
'gfc_warning' to have line numbers correctly reported.
2006-09-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29060
* gfortran.dg/spread_shape_1.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117014
138bc75d-0d04-0410-961f-
82ee72b054a4
+2006-09-18 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/29060
+ * iresolve.c (resolve_spread): Build shape for result if the
+ source shape is available and dim and ncopies are constants.
+
+2006-09-18 Tobias Schl\81üter <tobias.schlueter@physik.uni-muenchen.de>
+
+ PR fortran/28817
+ PR fortran/21918
+ * trans-decl.c (generate_local_decl): Change from 'warning' to
+ 'gfc_warning' to have line numbers correctly reported.
+
2006-09-15 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29051
? PREFIX("spread_char")
: PREFIX("spread"));
+ if (dim && gfc_is_constant_expr (dim)
+ && ncopies && gfc_is_constant_expr (ncopies)
+ && source->shape[0])
+ {
+ int i, idim;
+ idim = mpz_get_ui (dim->value.integer);
+ f->shape = gfc_get_shape (f->rank);
+ for (i = 0; i < (idim - 1); i++)
+ mpz_init_set (f->shape[i], source->shape[i]);
+
+ mpz_init_set (f->shape[idim - 1], ncopies->value.integer);
+
+ for (i = idim; i < f->rank ; i++)
+ mpz_init_set (f->shape[i], source->shape[i-1]);
+ }
+
+
gfc_resolve_dim_arg (dim);
gfc_resolve_index (ncopies, 1);
}
if (sym->attr.referenced)
gfc_get_symbol_decl (sym);
else if (sym->attr.dummy && warn_unused_parameter)
- warning (0, "unused parameter %qs", sym->name);
+ gfc_warning ("Unused parameter %s declared at %L", sym->name,
+ &sym->declared_at);
/* Warn for unused variables, but not if they're inside a common
block or are use-associated. */
else if (warn_unused_variable
&& !(sym->attr.in_common || sym->attr.use_assoc))
- warning (0, "unused variable %qs", sym->name);
+ gfc_warning ("Unused variable %s declared at %L", sym->name,
+ &sym->declared_at);
/* For variable length CHARACTER parameters, the PARM_DECL already
references the length variable, so force gfc_get_symbol_decl
even when not referenced. If optimize > 0, it will be optimized
+2006-09-18 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/29060
+ * gfortran.dg/spread_shape_1.f90: New test.
+
2006-09-17 Roger Sayle <roger@eyesopen.com>
PR tree-optimization/28887
--- /dev/null
+! { dg-do compile }
+! Tests the fix for PR29060 in which the shape of the result
+! of SPREAD was not available to the scalarizer.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+ real,dimension(:, :),pointer :: ptr
+ real,dimension(2, 2),parameter :: u = &
+ reshape((/0.25, 0.5, 0.75, 1.00/),(/2,2/))
+ allocate (ptr(2,2))
+
+! Original PR
+ ptr(:, :) = u + spread ((/1.0, 2.0/), 2, size(u, 2))
+ if (any (ptr .ne. &
+ reshape ((/1.25, 2.50, 1.75, 3.00/), (/2, 2/)))) call abort ()
+
+! Check that the fix works correctly with the source shape after ncopies
+ ptr(:, :) = u + spread ((/2.0, 3.0/), 1, size (u, 1))
+ if (any (ptr .ne. &
+ reshape ((/2.25, 2.50, 3.75, 4.00/), (/2,2/)))) call abort ()
+end