* [Patch, Fortran, committed] CO_MIN/MAX/SUM fixes
@ 2014-06-19 7:17 Tobias Burnus
2014-06-20 5:32 ` Tobias Burnus
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2014-06-19 7:17 UTC (permalink / raw)
To: gcc-patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 702 bytes --]
This patches fixes a few bugs related to CO_MIN/MAX/SUM:
* The recent patch missed to update the argument in trans-intrinsic, it
had the changes only in trans-decl and libgfortran/caf.
* in libcaf_single, setting stat to 0 had a bug
* There were several multi-image bugs in the collective_2.
Additionally, passing an array with vector subscript doesn't make sense
as the first argument is (at least without image_index) intent(inout) â
but that's not permitted with vector subscripts.
I will add a check to check.c in a follow up patch â and update also the
caf_send/caf_sendget API as there the same applies and one can remove
that extra argument.
Committed as Rev. 211816.
Tobias
[-- Attachment #2: caf-fix.diff --]
[-- Type: text/x-patch, Size: 5362 bytes --]
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 211815)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2014-06-19 Tobias Burnus <burnus@net-b.de>
+
+ * trans-intrinsic.c (conv_co_minmaxsum): Fix argument
+ passing.
+
2014-06-18 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (OpenMP): Update refs to OpenMP 4.0.
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c (Revision 211815)
+++ gcc/fortran/trans-intrinsic.c (Arbeitskopie)
@@ -8300,13 +8300,11 @@ conv_co_minmaxsum (gfc_code *code)
gcc_unreachable ();
if (code->resolved_isym->id == GFC_ISYM_CO_SUM)
- fndecl = build_call_expr_loc (input_location, fndecl, 6, array,
- null_pointer_node, image_index, stat, errmsg,
- errmsg_len);
+ fndecl = build_call_expr_loc (input_location, fndecl, 5, array,
+ image_index, stat, errmsg, errmsg_len);
else
- fndecl = build_call_expr_loc (input_location, fndecl, 7, array,
- null_pointer_node, image_index, stat, errmsg,
- strlen, errmsg_len);
+ fndecl = build_call_expr_loc (input_location, fndecl, 6, array, image_index,
+ stat, errmsg, strlen, errmsg_len);
gfc_add_expr_to_block (&block, fndecl);
gfc_add_block_to_block (&block, &post_block);
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 211815)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,9 +1,14 @@
+2014-06-19 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/coarray/collectives_2.f90: Extend
+ and make valid.
+
2014-06-18 Tom de Vries <tom@codesourcery.com>
* gcc.target/aarch64/fuse-caller-save.c: New test.
2014-06-18 Radovan Obradovic <robradovic@mips.com>
- Tom de Vries <tom@codesourcery.com>
+ Tom de Vries <tom@codesourcery.com>
* gcc.target/arm/fuse-caller-save.c: New test.
Index: gcc/testsuite/gfortran.dg/coarray/collectives_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray/collectives_2.f90 (Revision 211815)
+++ gcc/testsuite/gfortran.dg/coarray/collectives_2.f90 (Arbeitskopie)
@@ -7,7 +7,7 @@ program test
intrinsic co_max
intrinsic co_min
intrinsic co_sum
- integer :: val(3)
+ integer :: val(3), tmp_val(3)
integer :: vec(3)
vec = [2,3,1]
if (this_image() == 1) then
@@ -21,14 +21,25 @@ program test
else
val(3) = 101
endif
+ tmp_val = val
call test_min
+ val = tmp_val
call test_max
+ val = tmp_val
call test_sum
contains
subroutine test_max
- call co_max (val(vec))
- !write(*,*) "Maximal value", val
+ integer :: tmp
+ call co_max (val(::2))
if (num_images() > 1) then
+ if (any (val /= [42, this_image(), 101])) call abort()
+ else
+ if (any (val /= [42, this_image(), -55])) call abort()
+ endif
+
+ val = tmp_val
+ call co_max (val(:))
+ if (num_images() > 1) then
if (any (val /= [42, num_images(), 101])) call abort()
else
if (any (val /= [42, num_images(), -55])) call abort()
@@ -40,20 +51,26 @@ contains
if (this_image() == num_images()) then
!write(*,*) "Minimal value", val
if (num_images() > 1) then
- if (any (val /= [-99, num_images(), -55])) call abort()
+ if (any (val /= [-99, 1, -55])) call abort()
else
- if (any (val /= [42, num_images(), -55])) call abort()
+ if (any (val /= [42, 1, -55])) call abort()
endif
+ else
+ if (any (val /= tmp_val)) call abort()
endif
end subroutine test_min
subroutine test_sum
integer :: n
- call co_sum (val, result_image=1)
+ n = 88
+ call co_sum (val, result_image=1, stat=n)
+ if (n /= 0) call abort()
if (this_image() == 1) then
n = num_images()
!write(*,*) "The sum is ", val
if (any (val /= [42 + (n-1)*(-99), (n**2 + n)/2, -55+(n-1)*101])) call abort()
+ else
+ if (any (val /= tmp_val)) call abort()
end if
end subroutine test_sum
end program test
Index: libgfortran/ChangeLog
===================================================================
--- libgfortran/ChangeLog (Revision 211815)
+++ libgfortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2014-06-19 Tobias Burnus <burnus@net-b.de>
+
+ * caf/single.c (_gfortran_caf_co_sum, _gfortran_caf_co_max,
+ _gfortran_caf_co_min): Fix stat setting.
+
2014-06-17 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (gfc_descriptor_t): New typedef.
Index: libgfortran/caf/single.c
===================================================================
--- libgfortran/caf/single.c (Revision 211815)
+++ libgfortran/caf/single.c (Arbeitskopie)
@@ -211,7 +211,7 @@ _gfortran_caf_co_sum (gfc_descriptor_t *a __attrib
int errmsg_len __attribute__ ((unused)))
{
if (stat)
- stat = 0;
+ *stat = 0;
}
void
@@ -222,7 +222,7 @@ _gfortran_caf_co_min (gfc_descriptor_t *a __attrib
int errmsg_len __attribute__ ((unused)))
{
if (stat)
- stat = 0;
+ *stat = 0;
}
void
@@ -233,7 +233,7 @@ _gfortran_caf_co_max (gfc_descriptor_t *a __attrib
int errmsg_len __attribute__ ((unused)))
{
if (stat)
- stat = 0;
+ *stat = 0;
}
void
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, Fortran, committed] CO_MIN/MAX/SUM fixes
2014-06-19 7:17 [Patch, Fortran, committed] CO_MIN/MAX/SUM fixes Tobias Burnus
@ 2014-06-20 5:32 ` Tobias Burnus
0 siblings, 0 replies; 2+ messages in thread
From: Tobias Burnus @ 2014-06-20 5:32 UTC (permalink / raw)
To: gcc-patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 201 bytes --]
Tobias Burnus wrote:
> This patches fixes a few bugs related to CO_MIN/MAX/SUM:
> Committed as Rev. 211816.
That patch required also the attached testsuite changes, committed as
Rev. 211833.
Tobias
[-- Attachment #2: caf.diff --]
[-- Type: text/x-patch, Size: 2764 bytes --]
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 211832)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,3 +1,10 @@
+2014-06-20 Tobias Burnus <burnus@net-b.de>
+
+ PR testsuite/61567
+ * gfortran.dg/coarray_collectives_5.f90: Update
+ dg-final scan-tree-dump-times.
+ * gfortran.dg/coarray_collectives_6.f90: Ditto.
+
2014-06-20 Hale Wang <hale.wang@arm.com>
* gcc.target/arm/lto/: New folder to verify the LTO option.
Index: gcc/testsuite/gfortran.dg/coarray_collectives_5.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray_collectives_5.f90 (Revision 211832)
+++ gcc/testsuite/gfortran.dg/coarray_collectives_5.f90 (Arbeitskopie)
@@ -13,7 +13,7 @@ program test
call co_sum(val, stat=stat3)
end program test
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_max \\(&desc.., 0B, 0, &stat1, 0B, 0, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_min \\(&desc.., 0B, 0, &stat2, 0B, 0, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_sum \\(&desc.., 0B, 0, &stat3, 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_max \\(&desc.., 0, &stat1, 0B, 0, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_min \\(&desc.., 0, &stat2, 0B, 0, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_sum \\(&desc.., 0, &stat3, 0B, 0\\);" 1 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
Index: gcc/testsuite/gfortran.dg/coarray_collectives_6.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray_collectives_6.f90 (Revision 211832)
+++ gcc/testsuite/gfortran.dg/coarray_collectives_6.f90 (Arbeitskopie)
@@ -20,7 +20,7 @@ program test
call co_min(val3, result_image=res,stat=stat3, errmsg=errmesg3)
end program test
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_max \\(&desc.., 0B, 0, &stat1, errmesg1, 0, 6\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_sum \\(&val2, 0B, 4, &stat2, errmesg2, 7\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_min \\(&desc.., 0B, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_max \\(&desc.., 0, &stat1, errmesg1, 0, 6\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_sum \\(&val2, 4, &stat2, errmesg2, 7\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_min \\(&desc.., res, &stat3, errmesg3, 99, 8\\);" 1 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-20 5:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-19 7:17 [Patch, Fortran, committed] CO_MIN/MAX/SUM fixes Tobias Burnus
2014-06-20 5:32 ` 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).