* [patch, fortran] Fix PR 36670, bounds check on product and sum
@ 2008-07-01 19:32 Thomas Koenig
2008-07-06 10:08 ` *ping* " Thomas Koenig
2008-07-07 19:07 ` [patch, fortran] " Tobias Burnus
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Koenig @ 2008-07-01 19:32 UTC (permalink / raw)
To: fortran; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 484 bytes --]
Hello world,
this rather self-explanatory patch fixes the missing bounds check
on the product and sum intrinsics.
Regression-tested on i686-pc-linux-gnu.
OK for trunk?
Thomas
2008-07-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36670
* iresolve.c (gfc_resolve_product): Set shape of return
value from array.
(gfc_resolve_sum): Likewise.
2008-07-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36670
* gfortran.dg/product_sum_bounds_1.f90: New test case.
[-- Attachment #2: product_sum_bounds_1.f90 --]
[-- Type: text/x-fortran, Size: 222 bytes --]
! { dg-do compile }
program main
real, dimension(4,3) :: a
real, dimension(2) :: b
a = 21.
b = product(a,dim=1) ! { dg-error "Different shape" }
b = sum(a,dim=2) ! { dg-error "Different shape" }
end program main
[-- Attachment #3: sum_product.diff --]
[-- Type: text/x-patch, Size: 736 bytes --]
Index: /home/ig25/gcc/trunk/gcc/fortran/iresolve.c
===================================================================
--- /home/ig25/gcc/trunk/gcc/fortran/iresolve.c (revision 137255)
+++ /home/ig25/gcc/trunk/gcc/fortran/iresolve.c (working copy)
@@ -1788,6 +1788,7 @@ gfc_resolve_product (gfc_expr *f, gfc_ex
if (dim != NULL)
{
f->rank = array->rank - 1;
+ f->shape = gfc_copy_shape_excluding (array->shape, array->rank, dim);
gfc_resolve_dim_arg (dim);
}
@@ -2271,6 +2272,7 @@ gfc_resolve_sum (gfc_expr *f, gfc_expr *
if (dim != NULL)
{
f->rank = array->rank - 1;
+ f->shape = gfc_copy_shape_excluding (array->shape, array->rank, dim);
gfc_resolve_dim_arg (dim);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* *ping* Fix PR 36670, bounds check on product and sum
2008-07-01 19:32 [patch, fortran] Fix PR 36670, bounds check on product and sum Thomas Koenig
@ 2008-07-06 10:08 ` Thomas Koenig
2008-07-07 19:07 ` [patch, fortran] " Tobias Burnus
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Koenig @ 2008-07-06 10:08 UTC (permalink / raw)
To: fortran; +Cc: gcc-patches
On Tue, 2008-07-01 at 21:18 +0200, Thomas Koenig wrote:
http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00040.html
> OK for trunk?
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch, fortran] Fix PR 36670, bounds check on product and sum
2008-07-01 19:32 [patch, fortran] Fix PR 36670, bounds check on product and sum Thomas Koenig
2008-07-06 10:08 ` *ping* " Thomas Koenig
@ 2008-07-07 19:07 ` Tobias Burnus
1 sibling, 0 replies; 3+ messages in thread
From: Tobias Burnus @ 2008-07-07 19:07 UTC (permalink / raw)
To: Thomas Koenig; +Cc: fortran, gcc-patches
Thomas Koenig wrote:
> Regression-tested on i686-pc-linux-gnu.
> OK for trunk?
>
Yes, OK.
Tobias
(Sorry for the late review.)
> 2008-07-01 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/36670
> * iresolve.c (gfc_resolve_product): Set shape of return
> value from array.
> (gfc_resolve_sum): Likewise.
>
> 2008-07-01 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/36670
> * gfortran.dg/product_sum_bounds_1.f90: New test case.
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-07 18:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-01 19:32 [patch, fortran] Fix PR 36670, bounds check on product and sum Thomas Koenig
2008-07-06 10:08 ` *ping* " Thomas Koenig
2008-07-07 19:07 ` [patch, fortran] " Tobias Burnus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).