re PR fortran/52161 (Internal compiler errors with -fcheck=bounds in coarray tests)
authorTobias Burnus <burnus@net-b.de>
Thu, 29 Nov 2012 08:43:48 +0000 (09:43 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Thu, 29 Nov 2012 08:43:48 +0000 (09:43 +0100)
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
        * coarray/sync_3.f90: Extend test.

From-SVN: r193924

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

index cc996fe2d55cd18c2fcc4cc86872efb82f5e883b..9530339e60624daea215f1cd606f8f4048f687d4 100644 (file)
@@ -1,3 +1,9 @@
+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
index 0c88c4aeda28c641d8bf61c7b67a13c15c678096..79dc27d903be20cae18b253696c374cf3b51e2ec 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 ad8880a34eec45e3edd632c4d26baabdd8207418..d270ee0936ec77a3afefbd62896ec1ee04550f08 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 ef5aa6c229b7fb57d216715d449cc731877a7edc..205a787767807ca74a2e32e785f59e5971271182 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" }