re PR fortran/53732 ("mismatching comparison operand types" on compile)
authorMikael Morin <mikael@gcc.gnu.org>
Thu, 5 Jul 2012 15:18:26 +0000 (15:18 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Thu, 5 Jul 2012 15:18:26 +0000 (15:18 +0000)
fortran/
PR fortran/53732
* trans-array.c (gfc_add_loop_ss_code): Disable self recursive calls
handling nested loop(s) if the subscript flag is true.

testsuite/
PR fortran/53732
* gfortran.dg/inline_sum_4.f90: New test.

From-SVN: r189292

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/inline_sum_4.f90 [new file with mode: 0644]

index 2b0483522a4d880527f5d9d8a66909a37859b407..3d85f29fd8226a122992ee05a150ee6622f5c10a 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-05  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/53732
+       * trans-array.c (gfc_add_loop_ss_code): Disable self recursive calls
+       handling nested loop(s) if the subscript flag is true.
+
 2012-07-05  Uros Bizjak  <ubizjak@gmail.com>
 
        PR fortran/53449
index f135af1ef30a7cc06be1f28d65a76a1acbb27318..d289ac30a9918b90999b2a4b94f26fd0f0c44de6 100644 (file)
@@ -2398,7 +2398,6 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
   gfc_ss_info *ss_info;
   gfc_array_info *info;
   gfc_expr *expr;
-  bool skip_nested = false;
   int n;
 
   /* Don't evaluate the arguments for realloc_lhs_loop_for_fcn_call; otherwise,
@@ -2487,12 +2486,7 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
          /* Add the expressions for scalar and vector subscripts.  */
          for (n = 0; n < GFC_MAX_DIMENSIONS; n++)
            if (info->subscript[n])
-             {
-               gfc_add_loop_ss_code (loop, info->subscript[n], true, where);
-               /* The recursive call will have taken care of the nested loops.
-                  No need to do it twice.  */
-               skip_nested = true;
-             }
+             gfc_add_loop_ss_code (loop, info->subscript[n], true, where);
 
          set_vector_loop_bounds (ss);
          break;
@@ -2548,7 +2542,7 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
        }
     }
 
-  if (!skip_nested)
+  if (!subscript)
     for (nested_loop = loop->nested; nested_loop;
         nested_loop = nested_loop->next)
       gfc_add_loop_ss_code (nested_loop, nested_loop->ss, subscript, where);
index c6870a1ef875da5bb46d91ca5fb69006b7529093..d929153b5a95900b626998f1839fc25279dfcd5c 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-05  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/53732
+       * gfortran.dg/inline_sum_4.f90: New test.
+
 2012-07-05  Steven Bosscher  <steven@gcc.gnu.org>
 
        * gcc.c-torture/compile/20000326-1.c: Fix to not optimize to empty.
diff --git a/gcc/testsuite/gfortran.dg/inline_sum_4.f90 b/gcc/testsuite/gfortran.dg/inline_sum_4.f90
new file mode 100644 (file)
index 0000000..c04510d
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-do compile }
+!
+! PR fortran/53732
+! this was leading to an internal "mismatching comparison operand types"
+! error.
+!
+! Original testcase by minzastro <minzastro@googlemail.com>
+! Fixed by Dominique Dhumieres <dominiq@lps.ens.fr>
+
+program test
+implicit none
+
+real(8) arr(4,4,4,4)
+
+arr(:,:,:,:) = 1d0
+
+arr(1,:,:,:) = sum(arr, dim=1, mask=(arr(:,:,:,:) > 0d0))
+
+end program test