2012-11-28 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 29 Nov 2012 08:43:48 +0000 (08:43 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 29 Nov 2012 08:43:48 +0000 (08:43 +0000)
        PR fortran/52161
        * trans-stmt.c (gfc_trans_sync): Fix bound checking
        for -fcoarray=lib.

2012-11-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52161
        * coarray/sync_3.f90: Extend test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193924 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/coarray/sync_3.f90

index cc996fe..9530339 100644 (file)
@@ -1,6 +1,12 @@
 2012-11-28  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/52161
+       * trans-stmt.c (gfc_trans_sync): Fix bound checking
+       for -fcoarray=lib.
+
+2012-11-28  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/52161
        * trans-stmt.c (gfc_trans_sync): Fix bound checking.
 
 2012-11-27  Tobias Burnus  <burnus@net-b.de>
index 0c88c4a..79dc27d 100644 (file)
@@ -784,12 +784,12 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
       else
        {
          tree cond2;
-         cond = fold_build2_loc (input_location, GE_EXPR, boolean_type_node,
+         cond = fold_build2_loc (input_location, GT_EXPR, boolean_type_node,
                                  images, gfort_gvar_caf_num_images);
          cond2 = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
                                   images,
                                   build_int_cst (TREE_TYPE (images), 1));
-         cond = fold_build2_loc (input_location, TRUTH_AND_EXPR,
+         cond = fold_build2_loc (input_location, TRUTH_OR_EXPR,
                                  boolean_type_node, cond, cond2);
        }
       gfc_trans_runtime_check (true, false, cond, &se.pre,
index ad8880a..d270ee0 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-28  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/52161
+       * coarray/sync_3.f90: Extend test.
+
 2012-11-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/55512
index ef5aa6c..205a787 100644 (file)
@@ -1,5 +1,6 @@
 ! { dg-do run }
 ! { dg-options "-fcheck=all" }
+! { dg-shouldfail "Invalid image number -1 in SYNC IMAGES" }
 !
 ! As sync_1, but with bounds checking enabled.
 ! PR fortran/52161
@@ -65,4 +66,10 @@ n = 5
 sync images (*,errmsg=str,stat=n)
 if (n /= 0) call abort()
 
+n = -1
+sync images ( num_images() )
+sync images (n) ! Invalid: "-1"
+
 end
+
+! { dg-output "Fortran runtime error: Invalid image number -1 in SYNC IMAGES" }