aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2012-07-05 15:18:26 +0000
committerMikael Morin <mikael@gcc.gnu.org>2012-07-05 15:18:26 +0000
commit573234ac8bd662ec1d9d5a235f13b39312c6cc03 (patch)
tree1ca2c1ab5da74b67f394e1aa8407772a8b3c76a0
parent44b9837c99f53c58a58bd90ddc0c3bbae4ce4f2a (diff)
downloadgcc-573234ac8bd662ec1d9d5a235f13b39312c6cc03.zip
gcc-573234ac8bd662ec1d9d5a235f13b39312c6cc03.tar.gz
gcc-573234ac8bd662ec1d9d5a235f13b39312c6cc03.tar.bz2
re PR fortran/53732 ("mismatching comparison operand types" on compile)
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
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-array.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/inline_sum_4.f9019
4 files changed, 32 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2b04835..3d85f29f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index f135af1..d289ac3 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c6870a1..d929153 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..c04510d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inline_sum_4.f90
@@ -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